default instance for IsString

Jeremy Shaw jeremy at
Sun Apr 22 22:57:33 CEST 2012

I have often wished for something like:

{-# LANGUAGE StringLiteralsAs Text #-}

where all string literals like:

> f = "foo"

would be translated to:

> f = (fromString "foo" :: Text)

I find that OverloadedStrings is too general and causes ambiguous type
errors. Additionally, I seldom find that I have more than one type of
string literal per file. Things tend to be all String, all Text, etc.
So, if I could just pick a concrete type for all the string literals
in my file, I would be happy.

- jeremy

On Sat, Apr 21, 2012 at 7:20 PM, Greg Weber <greg at> wrote:
> I would like to default IsString to use the Text instance to avoid
> ambiguous type errors.
> I see defaulting capability is available for Num. Is there any way to
> do this for IsString?
> Thanks,
> Greg Weber
> _______________________________________________
> Glasgow-haskell-users mailing list
> Glasgow-haskell-users at

More information about the Glasgow-haskell-users mailing list