Contents
- What “overloaded” means
- How it works
- Alternatives to
String
- Unusual instances
- ByteString
- Aeson
- Cabal
- Hazard: Type ambiguity
Video
- 13 minutes
The OverloadedStrings
extension makes string literal syntax more general, allowing string literals to denote values of types other than String
. This extension is often used with the text package.
There are some of the pitfalls of string overloading which we discuss below: it is troublesome for some types, and it has the potential to introduce type ambiguity. In some cases you may want to consider using QuasiQuotes
, a more powerful but more cumbersome tool, instead.
Overloaded stringsGHC documentation for OverloadedStrings
(and the Data.String
module)Data.String
first appeared in GHC 6.8.1.