Strings are not primitive types, but a list of characters.
For example,
"abc" :: String
-- is actually:
['a','b','c'] :: [Char]Because of this, polymorphic functions on lists, can be used with strings.
"abcde" !! 2
-- 'c'
take 3 "abcde"
-- "abc"
length "abcde"
-- 5
zip "abc" [1,2,3,4]
-- [('a',1),('b',2),('c',3)]And you can use list comprehensions with Strings.
count :: Char -> String -> Int
count x xs = length [x' | x' <- xs, x == x']
count 'a' "paragraph"
-- 3