Skip to content

Disparity in error message in GHCi with : load vs writing directly in GHCi

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

Trac metadata
Trac field Value
Version
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component GHCi
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information