Type family bug?

Richard Eisenberg rae at cs.brynmawr.edu
Thu Jan 19 13:03:44 UTC 2017

This is correct behavior. The former has a CUSK, as all open type families have CUSKs with un-annotated kinds defaulting to Type. The latter does not have a CUSK, because the result kind is unknown. You therefore cannot specialize the k variable in the definition of the latter.

There is a ticket (#10141) about improving the error message here to educate the user about CUSKs, but there's no progress on it.


> On Jan 19, 2017, at 5:02 AM, Simon Peyton Jones <simonpj at microsoft.com> wrote:
> Richard 
> This works
> type family F (a :: k)
> type instance F Maybe = Char
> But this does not.  Surely it should?
> type family F (a :: k) where -- = r  | r -> a where
>   F Maybe = Char
> The latter is rejected with
> Foo.hs:6:5: error:
>     * Expecting one more argument to `Maybe'
>       Expected kind `k', but `Maybe' has kind `* -> *'
>     * In the first argument of `F', namely `Maybe'
>       In the type family declaration for `F'
> If you agree I’ll open a ticket.
> Simon

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20170119/7d112473/attachment.html>

More information about the ghc-devs mailing list