default instance for IsString

Yitzchak Gale gale at
Tue Apr 24 10:46:15 CEST 2012

Simon Peyton-Jones wrote:
> If you want validation of literal strings, then TH quasiquotes are the way to go:

I agree. OverloadedStrings is, in effect, an unsafe replacement
for quasiquotes. People find OverloadedStrings easier to use
than quasiquotes, so its use in that way is becoming popular.

What we need is a mechanism for allowing
string literals to have the type Text or ByteString
instead of String.

I do not want to be forced to turn on UnsafeQuasiQuotes
every time I need a string literal. So in my opinion,
OverloadedStrings is the wrong mechanism for
providing Text and ByteString literals.

Alternatives that have been suggested:

o A hard-coded pragma to specify the type of string
literals in a module as Text or ByteString.

o An extra method of IsString, of type QuasiQuoter,
that runs at compile time in a monomorphic context.

o As above, but only check syntax at compile
time in a monomorphic context. That allows
a simpler API, without requiring any TH knowledge
in most cases.


More information about the Glasgow-haskell-users mailing list