[GHC] #13917: The line on which to locate the error indication is bad.

GHC ghc-devs at haskell.org
Tue Jul 4 09:57:27 UTC 2017


#13917: The line on which to locate the error indication is bad.
-------------------------------------+-------------------------------------
        Reporter:  vanto             |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.0.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Incorrect         |  Unknown/Multiple
  error/warning at compile-time      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by vanto):

 Replying to [[span(style=color: #FF0000, j.waldmann )]]\\
 Interesting! I can do better.\\

 {{{
 module Qwer where

 a = ({-# LANGUAGE KindSignatures #-})

 main :: IO ()
 main = print (if True then () else ())
 }}}
 One more thing. If I change your code like that\\

 {{{
 module Qwer where

 a = ({-# LANGUAGE KindSignatures #-})

   main :: IO ()
 main = print (if True then () else ())
 }}}
 GHC says\\

 {{{
 Prelude> :l qwer.hs
 [1 of 1] Compiling Qwer             ( qwer.hs, interpreted )

 qwer.hs:3:5: error:
     * Couldn't match expected type `IO () -> IO ()'
                   with actual type `()'
     * The function `()' is applied to one argument,
       but its type `()' has none
       In the expression: () main :: IO ()
       In an equation for `a': a = () main :: IO ()
   |
 3 | a = ({-# LANGUAGE KindSignatures #-})
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...
 Failed, modules loaded: none.
 }}}
 Anyway the code you wrote is not pretty.
 Clarity of a program is very important especially in software maintenance.

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


More information about the ghc-tickets mailing list