GHCi is being too "helpful"

Dinko Tenev dinko.tenev at gmail.com
Fri Jan 25 10:37:07 EST 2008


Hi everyone,

When evaluating an IO monad in GHCi from the 6.6.1 distribution, the
REPL tries to be a bit too smart about printing out the returned
value.  For example, () values are not printed:

    Prelude System.Directory> setCurrentDirectory "work"
    Prelude System.Directory>

...but String, or, as far as I can see, any other values, do get printed:

    Prelude System.Directory> getCurrentDirectory
    "/home/shinobi"
    Prelude System.Directory> set

In my particular case, the value printed is a 250,000-element list --
waiting for the value to print out is not an option.  I don't want to
see the whole list at once, but do need to examine parts of it,
subject it to intermediate transformations, etc.

Is there any way to suppress this output and revert to the old
behavior, where the value was simply bound to "it", without being
printed?


Thanks,

D. Tenev


More information about the Glasgow-haskell-users mailing list