[GHC] #13197: Perplexing levity polymorphism issue

GHC ghc-devs at haskell.org
Sat Jan 28 03:44:29 UTC 2017


#13197: Perplexing levity polymorphism issue
-------------------------------------+-------------------------------------
        Reporter:  bgamari           |                Owner:
            Type:  bug               |               Status:  new
        Priority:  highest           |            Milestone:  8.2.1
       Component:  Compiler (Type    |              Version:  8.1
  checker)                           |
      Resolution:                    |             Keywords:  typeable
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  GHC rejects       |  Unknown/Multiple
  valid program                      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by bgamari):

 For the record the above fails with,
 {{{

 Test.hs:34:33: error:
     • Could not deduce: (r2 :: RuntimeRep)
                         ~~
                         ('LiftedRep :: RuntimeRep)
       from the context: ((* :: *) ~~ (* :: *),
                          (k :: *) ~~ ((a2 -> b) :: *))
         bound by a pattern with constructor:
                    TypeFun :: forall (a :: TYPE r1) (b :: TYPE r2).
                               TypeRep (TYPE r1) a -> TypeRep (TYPE r2) b
 -> TypeRep * (a -> b),
                  in a pattern binding in
                       pattern guard for
                       an equation for ‘toApp’
         at Test.hs:32:5-19
       or from: ((* :: *) ~~ (TYPE r1 :: *), (k1 :: *) ~~ (a2 :: TYPE r1))
         bound by a pattern with constructor:
                    HRefl :: forall k2 (a :: k2). (:~~:) k2 k2 a a,
                  in a pattern binding in
                       pattern guard for
                       an equation for ‘toApp’
         at Test.hs:33:10-14
       ‘r2’ is a rigid type variable bound by
         a pattern with constructor:
           TypeFun :: forall (a :: TYPE r1) (b :: TYPE r2).
                      TypeRep (TYPE r1) a -> TypeRep (TYPE r2) b -> TypeRep
 * (a -> b),
         in a pattern binding in
              pattern guard for
              an equation for ‘toApp’
         at Test.hs:32:5-19
       When matching the kind of ‘b’
       Expected type: TypeRep (k1 -> b) a
         Actual type: TypeRep k a
     • In the first argument of ‘TypeApp’, namely ‘f’
       In the first argument of ‘SomeTypeRep’, namely ‘(TypeApp f a)’
       In the second argument of ‘($)’, namely ‘SomeTypeRep (TypeApp f a)’
     • Relevant bindings include
         res :: TypeRep (TYPE r2) b (bound at Test.hs:32:17)
    |
 34 |   = Just $ SomeTypeRep (TypeApp f a)
    |                                 ^
 }}}

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


More information about the ghc-tickets mailing list