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

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

#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 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by heisenbug): * Attachment "T13770.hs" added. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13770 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#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 Resolution: | Keywords: 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 goldfire): Just took a quick look: this is not just `-fprint-explicit-runtime-reps`, which is what I thought. Possibly a tidying error? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13770#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#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 Resolution: | Keywords: 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 heisenbug): I believe the `r4` unification-variable originates from the two wildcard arguments (https://ghc.haskell.org/trac/ghc/attachment/ticket/13770/T13770.hs#L27) hidden in `Fun{}`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13770#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#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 Resolution: | Keywords: 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 simonpj): Yes, this is a tidying problem. The `PatSkol` constructor does not carry a tidy-able type. It should be treated more like `SigSkol`. But what do we ''want'' the error message to say? Consider {{{ data T a where MkT :: a -> b -> T a f :: T [p] -> Int f (MkT x y) = ... }}} Now, if there is an error in the `...`, involving the skolem `b` bound by the `(MkT x y)` pattern, would we like this? {{{ 'b4' is a rigid type variable bound by a pattern with constructor: MkT :: [p] -> b4 -> T [p] }}} Notice that I have instantiated the universal argument too... I see no alternative to doing so. To be comprehensible we must instantiate the existential argument to match the one reported (remember there may be many nested `MkT` matches). That's what I propose. Sound ok? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13770#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC