Skip to content

HEAD: Type mentioned in error won't show up in pattern signature

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@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.

Trac metadata
Trac field Value
Version 8.3
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information