[Haskell-cafe] do ghci

Matthias Fischmann fis at wiwi.hu-berlin.de
Thu Oct 12 03:50:09 EDT 2006


On Wed, Oct 11, 2006 at 05:13:13PM -0700, Greg Fitzgerald wrote:
> To: Haskell Cafe <haskell-cafe at haskell.org>
> From: Greg Fitzgerald <garious at gmail.com>
> Date: Wed, 11 Oct 2006 17:13:13 -0700
> Subject: [Haskell-cafe] do ghci
> 
> Just curious, why does ghci run in the context of a 'do'?
> 
> This tripped me up when I first started learning Haskell.  It's fine once
> you know what's going on, but why the restriction?  Why can't I write the
> code below without 'let' and ':module'?
> 
> >two = 1 + 1
> >import Data.List
> >cols = transpose [[1,2,3], [4,5,6]]

If you interact with a command line, it is natural to have IO side
effects and evaluate the command lines in the order of appearance.
ghci is sort of a command line, right?

It is straight-forward enough to make up something ad hoc without
using the concept of monadic IO and memory modification, but why?

matthias
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20061012/ff9921e8/attachment-0001.bin


More information about the Haskell-Cafe mailing list