[Haskell-cafe] How can I stop GHCi from calling "show" for IO actions?

Ryan Ingram ryani.spam at gmail.com
Sat Sep 15 23:35:02 EDT 2007


Prelude> let inf = repeat 1
Prelude> inf
[1,1,(lots of output until I press ctrl-c),Interrupted.
(I expect this to happen)
Prelude> let x = inf
(no output here!)
Prelude> :t x
x :: [Integer]
Prelude> return inf
[1,1,(lots of output until I press ctrl-c),Interrupted.
(I also expect this to happen)
Prelude> y <- return inf
[1,1,(lots of output until I press ctrl-c),Interrupted.
(I do not expect this to happen here!)
Prelude> :t y

<interactive>:1:0: Not in scope: 'y'

Is this a bug?  Why does "y <- return exp" have different behavior
than "let y = exp"?  Is there a way to make GHCi not print the result
of an action but still make my variables get bound?

  -- ryan


More information about the Haskell-Cafe mailing list