
#14995: QuantifiedConstraints: Incorrect pretty printing -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: GHCi | Version: 8.2.2 Resolution: | Keywords: | QuantifiedConstraints, wipT2893 Operating System: Unknown/Multiple | Architecture: Type of failure: Poor/confusing | Unknown/Multiple error message | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): This is like #14897. It'l be fine if you say `:info k`. But with `:t k` you are asking GHC to infer the type of the expression `k`. So it instantiates `k` to get the constraint {{{ [W] ((C a1 => B a1 b1)) -- A quantified constraint }}} As usual `a1` and `b1` are unification variables. To solve a quantified constraint we create an implication constraint {{{ forall {}. C a1 => [W] B a1 b1 }}} Now we are stuck, so we try to generalise. GHC tries to find a simple constraint to generalise over, and `B a1 b1` does the job. GHC ''never'' infers a quantified constraint. So `:t` will never display a quantified constraint. I don't know whether others trip over this `:type` vs `:info` distinction, but you certainly do! Maybe `:type` should work only on identifiers, and be identical to `:info`. We could have something else for arbitrary expressions. Or maybe `:type` should behave non-uniformly for identifiers. Opinions welcome. But as it stands it's by-design. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14995#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler