default instance for IsString

Markus Läll markus.l2ll at gmail.com
Tue Apr 24 11:30:20 CEST 2012


You do know, that you already *can* have safe Text and ByteString from
an overloaded string literal.

On Tue, Apr 24, 2012 at 11:46 AM, Yitzchak Gale <gale at sefer.org> wrote:
> 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.
>
> Thanks,
> Yitz
>
> _______________________________________________
> Glasgow-haskell-users mailing list
> Glasgow-haskell-users at haskell.org
> http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



-- 
Markus Läll



More information about the Glasgow-haskell-users mailing list