[GHC] #11673: Doesn't accept type

GHC ghc-devs at haskell.org
Fri Mar 4 11:17:48 UTC 2016


#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


More information about the ghc-tickets mailing list