default instance for IsString

Simon Peyton-Jones simonpj at microsoft.com
Sun Apr 22 20:51:11 CEST 2012


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

Maybe so. It's open to anyone to make a concrete proposal.  See
  http://hackage.haskell.org/trac/ghc/ticket/6030
which may be the same issue.

Simon

|  -----Original Message-----
|  From: glasgow-haskell-users-bounces at haskell.org [mailto:glasgow-haskell-users-
|  bounces at haskell.org] On Behalf Of Johan Tibell
|  Sent: 22 April 2012 18:51
|  To: Brent Yorgey
|  Cc: glasgow-haskell-users at haskell.org
|  Subject: Re: default instance for IsString
|  
|  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





More information about the Glasgow-haskell-users mailing list