In Haskell String is an alias for [Char]:

type String = [Char]

If you just want a function that converts a single char to a string you could e.g. do

charToString :: Char -> String
charToString c = [c]

If you prefer pointfree style you could also write

charToString :: Char -> String
charToString = (:[])
Answer from Thies Heidecke on Stack Overflow
🌐
Hackage
hackage.haskell.org › package › base-4.3.1.0 › docs › Data-Char.html
Data.Char - Hackage - Haskell.org
Convert a character to a string using only printable characters, using Haskell source-language escape conventions.
🌐
TutorialsPoint
tutorialspoint.com › haskell-program-to-convert-character-to-string
Haskell Program to Convert Character to String
March 28, 2023 - In Haskell, we can convert Character to String by using user-defined function, show function, list comprehension and (:[]) notation. In the first example, we are going to use (charToString c = [c]) function and in the second example, we are going to use (charToString c = show c) function.
🌐
Reddit
reddit.com › r/haskell › how to concatenate a character to a string
How to concatenate a character to a string : r/haskell
January 30, 2023 - Share ... Remember String is just a type alias for [Char]. You cant concatenate a Char to a [Char]. But you can concatenate a List with a single Char with another list of Char ( [head s1] ++ s2 ), or even prepend the single Char to a list of Char ( head s1 : s2 )
🌐
Hasufell
hasufell.github.io › posts › 2024-05-07-ultimate-string-guide.html
The ultimate guide to Haskell Strings · Hasufell's blog
May 7, 2024 - I hope this blog post can fill some of the documentation gaps and also explain the newly introduced types and why I think that we don’t have too many String types. The most widely used String type in Haskell is defined by the Haskell Standard in Chapter 9 Standard Prelude: -- Lists data [a] = [] | a : [a] -- Not legal Haskell; for illustration only -- Character type data Char = ...
🌐
Hackage
hackage.haskell.org › package › haskell98 › docs › Char.html
Char - Hackage - Haskell
Convert a character to a string using only printable characters, using Haskell source-language escape conventions.
🌐
Haskell
haskell.org › hugs › pages › libraries › base › Data-Char.html
Data.Char
The character type Char is an enumeration whose values represent Unicode (or equivalently ISO/IEC 10646) characters (see http://www.unicode.org/ for details). This set extends the ISO 8859-1 (Latin-1) character set (the first 256 charachers), which is itself an extension of the ASCII character ...
Find elsewhere
🌐
Elte
lambda.inf.elte.hu › haskell › doc › libraries › base-4.11.1.0 › Data-Char.html
Data.Char
Convert a character to a string using only printable characters, using Haskell source-language escape conventions.
🌐
Uni-freiburg
www2.informatik.uni-freiburg.de › ~thiemann › haskell › haskell98-library-html › char.html
The Haskell 98 Library Report: Character Utilities
The function showLitChar converts a character to a string using only printable characters, using Haskell source-language escape conventions. The function lexLitChar does the reverse, returning the sequence of characters that encode the character. The function readLitChar does the same, but ...
🌐
Haskell
downloads.haskell.org › ~ghc › 6.4.2 › docs › html › libraries › base › Data-Char.html
Data.Char
The character type Char is an enumeration whose values represent Unicode (or equivalently ISO 10646) characters. This set extends the ISO 8859-1 (Latin-1) character set (the first 256 charachers), which is itself an extension of the ASCII character set (the first 128 characters).
🌐
Dal University
web.cs.dal.ca › ~nzeh › Teaching › 3137 › haskell › first_steps › basic_types › strings
Characters and Strings - CSCI 3137: Haskell Programming
The type of a list that contains elements of type a is [a]. So, the String type in Haskell is literally defined as a type alias for [Char]: ... We'll learn about the type keyword to define type aliases later.
🌐
Hackage
hackage.haskell.org › package › base › docs › Data-Char.html
Data.Char - Hackage - Haskell
Convert a character to a string using only printable characters, using Haskell source-language escape conventions.
🌐
ZVON
zvon.org › other › haskell › Outputprelude › String_d.html
Haskell : String
Enjoy! ZVON team Any suggestions send to webmaster@zvon.org, please
🌐
Lotz84
lotz84.github.io › haskellbyexample › ex › string-functions
Haskell by Example: String Functions
import Data.List import Data.Char include :: String -> String -> Bool include xs ys = or . map (isPrefixOf ys) . tails $ xs joinWith :: [String] -> String -> String joinWith xs sep = concat . init . concat $ [[x, sep] | x <- xs] split :: String -> Char -> [String] split "" _ = [] split xs c = let (ys, zs) = break (== c) xs in if null zs then [ys] else ys : split (tail zs) c main = do putStrLn $ "Contains: " ++ show ("test" `include` "es") putStrLn $ "Count: " ++ show (length . filter (=='t') $ "test") putStrLn $ "HasPrefix: " ++ show (isPrefixOf "te" "test") putStrLn $ "HasSuffix: " ++ show (i
🌐
Real World Haskell
book.realworldhaskell.org › read › characters-strings-and-escaping-rules.html
Appendix B. Characters, strings, and escaping rules
Haskell allows Unicode characters to be written using numeric escapes. A decimal character begins with a digit, e.g. \1234. A hexadecimal character begins with an x, e.g. \xbeef. An octal character begins with an o, e.g. \o1234. The maximum value of a numeric literal is \1114111, which may also be written \x10ffff or \o4177777. String literals can contain a zero-width escape sequence, written \&. This is not a real character, as it represents the empty string.
🌐
Monday Morning Haskell
mmhaskell.com › blog › 2017 › 5 › 15 › untangling-haskells-strings
Untangling Haskell's Strings — Monday Morning Haskell
December 9, 2023 - So whenever you see [Char] in your compile errors, know this refers to the basic String type. By default, when you enter in a string literal in your Haskell code, the compiler infers it as a String.
🌐
Hackage
hackage.haskell.org › package › text-0.3 › docs › Data-Text.html
Data.Text - Hackage - Haskell
O(n) Convert a Text into a String. Subject to array fusion. ... O(1) Convert a character into a Text.