[GHC] #11673: Doesn't accept type

#11673: Doesn't accept type -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.1 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- {{{#!hs import Data.Kind import qualified Control.Category as Cat newtype Transformer f g where Transform :: (forall i. f i ~> g i) -> Transformer f g type family (~>) :: k -> k -> Type where (~>) = (->) (~>) = Transformer instance Cat.Category ((~>) :: k -> k -> Type) => Cat.Category (Transformer :: (i -> k) -> (i -> k) -> Type) where id :: forall (f :: i -> k). Transformer f f id = Transform Cat.id }}} works, as well as omitting the instance signature: {{{#!hs id = Transform Cat.id }}} Implicitly quantifying `f` or omitting its kind signature result in the same error: {{{#!hs id :: Transformer f f id = Transform Cat.id -- • Could not deduce (Cat.Category (~>)) -- arising from a use of ‘Cat.id’ -- from the context: Cat.Category (~>) -- bound by the instance declaration at /tmp/tX81.hs:(13,3)-(15,60) -- • In the first argument of ‘Transform’, namely ‘Cat.id’ -- In the expression: Transform Cat.id -- In an equation for ‘id’: id = Transform Cat.id -- Compilation failed. }}} Should it compile -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11673 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11673: Doesn't accept type -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 8.1 Resolution: invalid | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by simonpj): * status: new => closed * resolution: => invalid Comment: Well, if you write {{{ instance ... where id :: Transformer f f id = ... }}} then GHC tries to understand the signature you wrote. Since `Transformer` poly-kinded, what you get is the signature {{{ id :: forall i k. forall (f :: i -> k). Transformer f foo }}} But `Cat.id` doesn't have that type. So I think this is just what's expected. Can you suggest any improvement to the user manual that would make this clearer? Simon -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11673#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC