#1721: Make GHCi print the entire result of an interactive 'bind' statement
--------------------------------+-------------------------------------------
Reporter: simonpj | Owner:
Type: feature request | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 6.6.1
Severity: normal | Resolution:
Keywords: | Difficulty: Unknown
Os: Unknown | Testcase:
Architecture: Unknown |
--------------------------------+-------------------------------------------
Comment (by simonpj):
Ryan Ingram writes: I think a more consistent behavior would be to not
print the LHS at all. If you wanted to print the result of the
computation you could just do:
{{{
Prelude> bar 5
}}}
or, if you also wanted bound variables afterwards:
{{{
Prelude> (x, Just y) <- bar 5
Prelude> (x, Just y)
}}}
Perhaps this is my imperative background speaking, but I don't see
much difference at the GHCi prompt between these two:
{{{
Prelude> let x = factorial 100
Prelude> x <- return (factorial 100)
}}}
I think they should have the same behavior by default; otherwise it's
just confusing to the new user.
For reference, I ran into this problem while playing around on the
ICFP contest problem, and I became quite frustrated trying to do
{{{
dna <- Data.ByteString.Char8.readFile "endo.dna"
}}}
and having to wait a few minutes for the console to catch up while
using GHCi as a simple interactive debugger.
The best argument I can think of for changing the default value of
that option is this:
* The workaround for printing the value of bound variables, if the
default is to not print and you don't know the options, is simple:
just type the bound variable in as an expression afterwards.
* On the other hand, there is no workaround to not print the value of
bound variables, if you don't know about the existence of that option.
In my case, I did do a cursory look to find an option to change this
behavior, but I missed it in the documentation.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1721>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs