[GHC] #14799: QuantifiedConstraints: Problems with Typeable

GHC ghc-devs at haskell.org
Fri Feb 23 23:43:46 UTC 2018


#14799: QuantifiedConstraints: Problems with Typeable
-------------------------------------+-------------------------------------
        Reporter:  Iceland_jack      |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.5
      Resolution:                    |             Keywords:
                                     |  QuantifiedConstraints, wipT2893
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by RyanGlScott):

 So your first example didn't compile for me:

 {{{
 Bug.hs:9:31: error: parse error on input ‘@’
   |
 9 | a (MkEx (_::xx)) = typeRep @_ @xx Proxy
   |                               ^
 }}}

 So I added `TypeApplications`:

 {{{#!hs
 {-# Language GADTs, ConstraintKinds, ScopedTypeVariables,
 QuantifiedConstraints #-}
 {-# Language TypeApplications #-}

 import Data.Typeable

 data Ex cls where
   MkEx :: cls xx => xx -> Ex cls

 a :: Ex Typeable -> TypeRep
 a (MkEx (_::xx)) = typeRep @_ @xx Proxy

 b :: (forall xx. cls xx => Typeable xx) => Ex cls -> TypeRep
 b (MkEx (_::xx)) = typeRep @_ @xx Proxy

 c :: (forall xx. cls xx => Show xx) => Ex cls -> String
 c (MkEx xx) = show xx
 }}}

 And now it compiles! So I'm not sure what you're doing differently.
 (Please make sure you've given us all the language extensions/flags you're
 using—it makes a huge difference!)

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14799#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list