Issue with type families
Tyson Whitehead
twhitehead at gmail.com
Thu Mar 4 17:05:18 EST 2010
On March 3, 2010 21:10:56 Daniel Fischer wrote:
> Well, GHC takes only the class head into account for instance selection,
> and
>
> u -> (v -> w)
>
> matches both,
>
> a -> b -- (a == u, b == v -> w)
>
> and
>
> m (c -> d) -- (m == ((->) u), c == v, d == w),
>
> ... <snip> ...
>
> are indeed conflicting, so you can't even use OverlappingInstances etc. to
> make it work.
Thanks very much for the explanation. I had only read 7.7 (Type families)
from the GHC manual. After reading what you wrote and all of 7.6 (Class and
instances declarations) a couple of times I think I've got it.
As it says in 7.7.2.2.2, "[t]he instance declarations of a type family used in
a single program may only overlap if the right-hand sides of the overlapping
instances coincide for the overlapping types."
Cheers! -Tyson
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://www.haskell.org/pipermail/glasgow-haskell-users/attachments/20100304/70ff46b3/attachment.bin
More information about the Glasgow-haskell-users
mailing list