[GHC] #15458: Misleading error message on mising BangPatterns extension

GHC ghc-devs at haskell.org
Mon Jul 30 20:31:59 UTC 2018


#15458: Misleading error message on mising BangPatterns extension
-------------------------------------+-------------------------------------
           Reporter:  sergv          |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:  8.6.1
          Component:  Compiler       |           Version:  8.4.3
           Keywords:                 |  Operating System:  Linux
       Architecture:  x86_64         |   Type of failure:  Poor/confusing
  (amd64)                            |  error message
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 For following program I'm getting an unexpected error message.

 {{{#!hs
 foo :: Int -> Int
 foo = bar
   where
     bar :: Int -> Int
     bar !i = i
 }}}

 {{{
 $ ghc -o Test Test.hs
 [1 of 1] Compiling Main             ( Test.hs, Test.o )

 Test.hs:4:5: error:
     The type signature for ‘bar’ lacks an accompanying binding
   |
 4 |     bar :: Int -> Int
   |     ^^^
 }}}

 Enabling `-XBangPatterns` fixes the issue but I wanted the compiler to
 suggest me to enable it:
 {{{
 $ ghc -XBangPatterns -o Test Test.hs
 [1 of 1] Compiling Main             ( Test.hs, Test.o )

 Test.hs:1:1: error:
     The IO action ‘main’ is not defined in module ‘Main’
   |
 1 | foo :: Int -> Int
   | ^
 }}}

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


More information about the ghc-tickets mailing list