#2157: Equality Constraints with Type Families
----------------------------------------+-----------------------------------
Reporter: hpacheco | Owner: chak
Type: feature request | Status: new
Priority: normal | Milestone:
Component: Compiler (Type checker) | Version: 6.9
Severity: normal | Resolution:
Keywords: | Testcase:
Architecture: Multiple | Os: Multiple
----------------------------------------+-----------------------------------
Comment (by chak):
Replying to [comment:6 hpacheco]:
> Curiously if I have
>
>
> {{{
> fff a = fmapF a id
> }}}
>
>
> it compiles correctly.
> But if I infer the type signature of fff I get
>
>
> {{{
> fff :: forall d x. (FunctorF d) => d -> F d x -> F d x
> }}}
>
>
> On the other side, a similar problem as before arises when
>
>
> {{{
> fff :: forall d x. (FunctorF d) => d -> F d x -> F d x
> fff a = fmapF a id
> }}}
>
>
> fails to compile.
> This must be a bug. Sorry for all this posts.
No, it's not as bug. The problem is that the variable `x` occurs
'''only''' as a type-index to the type family in the signature. Remember
from above, as the arity of `F` is 2, given `F a1 b1 ~ F a2 b2` we '''can
not''' deduce that `a1 ~ a2` and `b1 ~ b2`. (We need to explain that
better in the type family documentation...)
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2157#comment:8>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs