Typechecker / OverloadedStrings question 7.8 vs. 7.10
Iavor Diatchki
iavor.diatchki at gmail.com
Mon Aug 3 17:15:05 UTC 2015
Hello,
what Reid says is exactly right---the issue is not really about what
instances are present, the problem is that GHC can't determine how to
instantiate `t0`.
Perhaps a more direct way to describe this is as follows:
Failed to infer type `t0`
while solving constraint `Data.String.IsString (t0 Char)`
arising from the use of:
elem :: a -> t0 a -> Bool
-Iavor
On Mon, Aug 3, 2015 at 9:47 AM, Brandon Allbery <allbery.b at gmail.com> wrote:
> On Mon, Aug 3, 2015 at 12:45 PM, Daniel Bergey <bergey at teallabs.org>
> wrote:
>
>> I thought GHC would infer the type when only one instance is in scope,
>> at least in some cases, like IsString. But I could well be wrong about
>> that.
>>
>
> Typeclasses are open-world; this is not a safe assumption, since instances
> are global and an instance added elsewhere at some point in the future
> could therefore break your program.
>
> --
> brandon s allbery kf8nh sine nomine
> associates
> allbery.b at gmail.com
> ballbery at sinenomine.net
> unix, openafs, kerberos, infrastructure, xmonad
> http://sinenomine.net
>
> _______________________________________________
> ghc-devs mailing list
> ghc-devs at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20150803/a95be33b/attachment.html>
More information about the ghc-devs
mailing list