[GHC] #10141: CUSK mysteries (was: Kind inference regression in closed type families)
GHC
ghc-devs at haskell.org
Wed Feb 8 17:32:34 UTC 2017
#10141: CUSK mysteries
-------------------------------------+-------------------------------------
Reporter: goldfire | Owner: goldfire
Type: bug | Status: new
Priority: normal | Milestone: 8.2.1
Component: Compiler | Version: 7.10.1-rc2
Resolution: | Keywords: TypeFamilies
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case: indexed-
| types/should_fail/T10141
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by simonpj):
Here's an example that I was baffled by. This works
{{{
type family F (a :: k)
type instance F Maybe = Char
}}}
But this does not.
{{{
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'
}}}
It is bizarre that one works and the other does not, and I was all ready
to open a ticket when Richard said: 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.
I can't help feeling that our CUSK story is a bit wonky, so I'm recording
it here.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10141#comment:15>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list