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

GHC ghc-devs at haskell.org
Wed Jul 1 04:01:14 UTC 2015


#10547: feature request: expanding type synonyms in error messages
-------------------------------------+-------------------------------------
        Reporter:  osa1              |                   Owner:  osa1
            Type:  feature request   |                  Status:  new
        Priority:  low               |               Milestone:  7.12.1
       Component:  Compiler (Type    |                 Version:
  checker)                           |                Keywords:
      Resolution:                    |            Architecture:
Operating System:  Unknown/Multiple  |  Unknown/Multiple
 Type of failure:  None/Unknown      |               Test Case:
      Blocked By:                    |                Blocking:
 Related Tickets:                    |  Differential Revisions:  D1016
-------------------------------------+-------------------------------------

Comment (by osa1):

 Simon, how does this look:

 I have this program:

 {{{
 module Main where

 type T5 = T4
 type T4 = T3
 type T3 = T2
 type T2 = T1
 type T1 = Int

 type T a = Int -> Bool -> a -> String

 f :: T (T3, T5, Int) -> Int
 f = undefined

 a :: Int
 a = f (undefined :: T (T5, T3, Bool))

 main = print a
 }}}

 and this is the error message:

 {{{
 ➜  t10547  ghc-stage1 Main.hs -fprint-expanded-synonyms
 [1 of 1] Compiling Main             ( Main.hs, Main.o )

 Main.hs:15:8: error:
     Couldn't match type ‘Int’ with ‘Bool’
     Expected type: T (T3, T5, Int)
       Actual type: T (T5, T3, Bool)
     Type synonyms expanded:
     Expected type: T (T3, T3, Int)
       Actual type: T (T3, T3, Bool)
     In the first argument of ‘f’, namely
       ‘(undefined :: T (T5, T3, Bool))’
     In the expression: f (undefined :: T (T5, T3, Bool))
     In an equation for ‘a’: a = f (undefined :: T (T5, T3, Bool))
 }}}

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


More information about the ghc-tickets mailing list