
#9171: Clarify error messages when there is a kind mismatch ----------------------------------------------+---------------------------- Reporter: MikeIzbicki | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects valid program | Unknown/Multiple Test Case: | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: ----------------------------------------------+---------------------------- Comment (by goldfire): I've written several type families where we really do want this behavior. I can't speak to ''why'' it was designed to work this way, but I have benefitted from this decision. One example is to be able to encode overloaded numbers in types: {{{ type family FromNat (n :: Nat) :: k type instance FromNat n = n -- identity type instance FromNat n = ToU n -- for UnaryNat type instance FromNat n = ToZ n -- for Z (integers) data UnaryNat = Zero | Succ UnaryNat type family ToU n where ToU 0 = Zero ToU n = Succ (ToU (n - 1)) data Z = ... type family ToZ n where ... }}} I admit that I'm probably in the minority at using this feature, but it ''is'' being used. On the other hand, it is a little alarming to most users at first, and it's definitely not the most intuitive feature. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9171#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler