#5277: Clash between RankNTypes and TypeFamilies
----------------------------------------+-----------------------------------
Reporter: stefan | Owner:
Type: bug | Status: closed
Priority: normal | Milestone:
Component: Compiler | Version: 7.0.3
Resolution: invalid | Keywords: rank-n types, type
families, type signatures
Testcase: | Blockedby:
Difficulty: | Os: Unknown/Multiple
Blocking: | Architecture: Unknown/Multiple
Failure: GHC rejects valid program |
----------------------------------------+-----------------------------------
Comment(by simonpj):
Did you read the FAQ I pointed you at? It (attempts to) explain precisely
why the type error occurs only when you add a type signature. Did that
not help?
If you want the type signature, you need to help the type checker to
resolve the ambiguity, thus:
{{{
{-# LANGUAGE ScopedTypeVariables, RankNTypes, TypeFamilies #-}
module T5277 where
type family F a b :: *
data W a b = W {unW :: F a b}
data T a = T {unT :: forall b. W a b}
f :: forall a b. T a -> F a b
f = unW . (unT :: T a -> W a b)
}}}
Simon
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5277#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs