Skip to content

Make GHCi print the entire result of an interactive 'bind' statement

Suppose

  foo :: Int -> IO (Maybe Int, Bool)

Then here's a GHCi interaction:

Prelude> foo 3
(Just 3,True)           -- Entire result printed
Prelude> (Just x, _) <- foo 3
3                       -- Value of x printed
Prelude> (Just x, y) <- foo 3
                        -- Nothing at all printed
Prelude> (_, _) <- foo 3
                        -- Nothing at all printed
Prelude> 

GHCi prints the result of a bind, p <- e, if and only if the pattern p binds exactly one variable. This is a bit odd; you get no info if it binds more than one.

A different and simpler behaviour would be to print the entire result every time. That is, all the commands above would print (Just 3, True).

I'm recording this ticket so that we remember the suggestion. I don't know for sure if it's a good one. Add comments if you have an opinion

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