default instance for IsString

Johan Tibell johan.tibell at
Sun Apr 22 19:51:16 CEST 2012

On Sun, Apr 22, 2012 at 10:37 AM, Brent Yorgey <byorgey at> wrote:
> I do not think this is a bug.  Since type classes are open, GHC does
> not do any reasoning of the form "X is the only instance in scope, so
> I will pick that one".  Other instances could be added at any time
> (perhaps in other modules).  In this particular instance, GHC has no
> reason to choose the Text instance other than the fact that it is the
> only instance in scope -- that is, type inference is not enough to
> determine that the Text instance should be chosen.
> However, I do agree that it would be nice to have a mechanism for
> specifying default instances for arbitrary (user-defined) type
> classes.

Couldn't we make a special case for IsString, like we do for Num,
given it's special syntactic association with OverloadedStrings?

-- Johan

More information about the Glasgow-haskell-users mailing list