[GHC] #13770: HEAD: Type mentioned in error won't show up in pattern signature

GHC ghc-devs at haskell.org
Tue May 30 12:13:52 UTC 2017


#13770: HEAD: Type mentioned in error won't show up in pattern signature
-------------------------------------+-------------------------------------
           Reporter:  heisenbug      |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.3
           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:
-------------------------------------+-------------------------------------
 I am encountering a stange problem:
 {{{
 ghc-stage2 T13770.hs -c -fprint-explicit-kinds

 T13770.hs:29:52: error:
     ? Could not deduce: (r4 :: GHC.Types.RuntimeRep)
                         ~~ ('GHC.Types.LiftedRep :: GHC.Types.RuntimeRep)
       from the context: (* ~ *, (f :: *) ~~ (arg -> res :: *))
         bound by a pattern with pattern synonym:
                    Fun :: forall k (fun :: k).
                           () =>
                           forall (arg :: TYPE r1) (res :: TYPE r2).
                           (k ~ *, (fun :: k) ~~ (arg -> res :: *)) =>
                           TypeRep (TYPE r1) arg -> TypeRep (TYPE r2) res
 -> TypeRep k fun,
                  in a pattern binding in
                       'do' block
         at T13770.hs:19:19-35
       or from: (* :: *) ~~ (TYPE r1 :: *)
         bound by a pattern with constructor:
                    Refl :: forall k (a :: k). (:~:) k a a,
                  in a pattern binding in
                       'do' block
         at T13770.hs:22:19-22
       or from: (* :: *) ~~ (TYPE r2 :: *)
         bound by a pattern with constructor:
                    Refl :: forall k (a :: k). (:~:) k a a,
                  in a pattern binding in
                       'do' block
         at T13770.hs:23:19-22
       or from: (TYPE r2 ~ *, (res :: TYPE r2) ~~ (arg1 -> res1 :: *))
         bound by a pattern with pattern synonym:
                    Fun :: forall k (fun :: k).
                           () =>
                           forall (arg :: TYPE r1) (res :: TYPE r2).
                           (k ~ *, (fun :: k) ~~ (arg -> res :: *)) =>
                           TypeRep (TYPE r1) arg -> TypeRep (TYPE r2) res
 -> TypeRep k fun,
                  in a pattern binding in
                       'do' block
         at T13770.hs:27:37-41
       ?r4? is a rigid type variable bound by
         a pattern with pattern synonym:
           Fun :: forall k (fun :: k).
                  () =>
                  forall (arg :: TYPE r1) (res :: TYPE r2).
                  (k ~ *, (fun :: k) ~~ (arg -> res :: *)) =>
                  TypeRep (TYPE r1) arg -> TypeRep (TYPE r2) res -> TypeRep
 k fun,
         in a pattern binding in
              'do' block
         at T13770.hs:27:37-41
       When matching the kind of ?arg1?
       Expected type: TypeRep * (arg1 -> res1)
         Actual type: TypeRep (TYPE r2) res
     ? In the second argument of ?postulate?, namely ?fargrep?
       In a stmt of a 'do' block: Refl <- postulate vrep fargrep
       In the expression:
         do A2 satur _ <- a2 retrep vrep
            fargrep at Fun {} <- pure retrep
            HRefl <- fargrep `eqTypeRep` retrep
            Refl <- postulate vrep fargrep
            ....
    |
 29 |                             Refl <- postulate vrep fargrep
    |                                                    ^^^^^^^
 }}}


 Notice how `r4` is mentioned in the error message but none of the
 signatures refer to it. This is confusing.

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


More information about the ghc-tickets mailing list