Strings
Explore the string data type in Haskell.
We'll cover the following...
The final basic data type we will cover is the String
data type. Once more, a ghci
terminal is available for you to follow along:
The String
type
Strings represent sequences of characters. To distinguish String
values from Char
values, they are written in double quotes (e.g. "hello"
). Strings can also be empty (""
).
Note that single character strings are not the same as characters: they are of a different type, and thus, are not the same value.
Prelude Data.Char> :t "a"
"a" :: String
Prelude
...