[GHC] #13912: Disparity in error message in GHCi with : load vs writing directly in GHCi

GHC ghc-devs at haskell.org
Sun Jul 2 07:28:18 UTC 2017


#13912: Disparity in error message in GHCi with : load vs writing directly in GHCi
-------------------------------------+-------------------------------------
           Reporter:  vanto          |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  GHCi           |           Version:
           Keywords:                 |  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:
-------------------------------------+-------------------------------------
 {{{
 module Maintest where
 a:: Int
 a = 'a'
 main = print "b"
 }}}
 If I load this program with the command {{{:load}}} its answer is\\

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

 maintest.hs:4:5: error:
     * Couldn't match expected type `Int' with actual type `Char'
     * In the expression: 'a'
       In an equation for `a': a = 'a'
   |
 4 | a = 'a'
   |     ^^^
 Failed, modules loaded: none.
 Prelude>
 }}}
 If I write this program directly in GHCi, its answer is\\

 {{{
 Prelude> :{
 Prelude| module Maintest where
 Prelude| a:: Int
 Prelude| a = 'a'
 Prelude| main = print "b"
 Prelude| :}

 <interactive>:20:5: error:
     * Couldn't match expected type `Int' with actual type `Char'
     * In the expression: 'a'
       In an equation for `a': a = 'a'
 Prelude>
 }}}
 This information has disappeared\\

 {{{
   |
 4 | a = 'a'
   |     ^^^
 }}}
 The version of GHCi used is this one {{{GHCi, version 8.2.0.20170507}}}

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


More information about the ghc-tickets mailing list