[Haskell-cafe] default instance for IsString

Markus Läll markus.l2ll at gmail.com
Sun Apr 22 21:40:19 CEST 2012

Isn't this a special case already?

I.e you already can default a string literal to anything you want, the
only thing needed is a language pragma (and more obvious docs). The
only "problem" is, that it's not part of the Haskell2010 report, and
thus not supported in other compilers (or is it?).

On Sun, Apr 22, 2012 at 8:51 PM, Johan Tibell <johan.tibell at gmail.com> wrote:
> On Sun, Apr 22, 2012 at 10:37 AM, Brent Yorgey <byorgey at seas.upenn.edu> 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
> _______________________________________________
> 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 Haskell-Cafe mailing list