[GHC] #10547: feature request: expanding type synonyms in error messages

GHC ghc-devs at haskell.org
Thu May 12 12:03:12 UTC 2016


#10547: feature request: expanding type synonyms in error messages
-------------------------------------+-------------------------------------
        Reporter:  osa1              |                Owner:
            Type:  feature request   |               Status:  new
        Priority:  low               |            Milestone:  8.0.1
       Component:  Compiler (Type    |              Version:
  checker)                           |
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
                                     |  typecheck/should_fail/ExpandSynsFail1,2,3,4
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D1016,
       Wiki Page:                    |  Phab:D2198
-------------------------------------+-------------------------------------

Comment (by osa1):

 Just as a test I added `-fprint-expanded-synonyms` to every `should_fail`
 test in `typechecker/`. Here's the diff:

 {{{
 --- ./tcfail016.stderr.normalised       2016-05-12 08:00:33.702460710
 -0400
 +++ ./tcfail016.comp.stderr.normalised  2016-05-12 08:00:33.702460710
 -0400
 @@ -3,5 +3,8 @@
       Couldn't match type ‘(t, Expr t)’ with ‘Expr t’
        Expected type: AnnExpr t -> [[Char]]
          Actual type: Expr t -> [[Char]]
 +      Type synonyms expanded:
 +      Expected type: (t, Expr t) -> [[Char]]
 +        Actual type: Expr t -> [[Char]]
       Relevant bindings include
          g :: AnnExpr t -> [[Char]] (bound at tcfail016.hs:8:1)

 --- ./tcfail068.stderr.normalised       2016-05-12 08:00:38.994460634
 -0400
 +++ ./tcfail068.comp.stderr.normalised  2016-05-12 08:00:38.994460634
 -0400
 @@ -13,6 +13,9 @@
          at tcfail068.hs:11:10
        Expected type: GHC.ST.ST s1 (IndTree s a)
          Actual type: GHC.ST.ST s1 (STArray s1 (Int, Int) a)
 +      Type synonyms expanded:
 +      Expected type: GHC.ST.ST s1 (STArray s (Int, Int) a)
 +        Actual type: GHC.ST.ST s1 (STArray s1 (Int, Int) a)
       In the first argument of ‘runST’, namely
          ‘(newSTArray ((1, 1), n) x)’
        In the expression: runST (newSTArray ((1, 1), n) x)

 --- ./T9774.stderr.normalised   2016-05-12 08:01:14.797460115 -0400
 +++ ./T9774.comp.stderr.normalised      2016-05-12 08:01:14.797460115
 -0400
 @@ -3,6 +3,9 @@
       Couldn't match type ‘Char’ with ‘[Char]’
        Expected type: String
          Actual type: Char
 +      Type synonyms expanded:
 +      Expected type: [Char]
 +        Actual type: Char
       In the first argument of ‘putStrLn’, namely ‘(assert True 'a')’
        In the expression: putStrLn (assert True 'a')
        In an equation for ‘foo’: foo = putStrLn (assert True 'a')
 }}}

 I think we can enable this by default as it's both stable and fast now.

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


More information about the ghc-tickets mailing list