Re: [Haskell-cafe] default instance for IsString

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
On Sun, Apr 22, 2012 at 10:37 AM, Brent Yorgey
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@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
-- Markus Läll
participants (1)
-
Markus Läll