#
Enable Overloaded Strings
By
In Haskell, literalstrings such as "Haskell"
are of type String
which is a
synonym for [Char]
(a list of chars).
:t "Haskell"
"Haskell" :: [Char]
Enabling the XOverloadedStrings
language extension allows you to use literal
strings for other string-like types, as well.
#
In a .hs file
{-# LANGUAGE OverloadedStrings #-}
#
In GHCi
:set -XOverloadedStrings
Now that overloaded strings are enabled, you can use literal strings for other string-like types.
:t "Haskell"
"Haskell" :: Data.String.IsString p => p