At 22.24 +0200 0-08-28, Vincenzo Ciancia wrote:
>...when I launch hugs in Haskell98 mode, it prompts me with "prelude>" and
>lets me do nice things, but not
>   x=3
>or
>   f x = x
>while I can do, instead, let x=3 in ...
>Why?

I think the answer is deeper, having to do with the fact that Haskell is a
pure language which should not have any assigns, a mutative operator. Thus,
a statement
    x = 1/0
is not viewed as an assignment, but as a permanent association of the name
"x" with the full expression on the right hand side, which should properly
not be on the top level, but within any module, which forces to end up in a
file. (And as it is a lazy language, the expression is only evaluated as
needed, so the divide-by-zero error will happen first when the value of x
is needed.)

One way around this would be to define a special interaction module in
which all the definitions entered interactively are put, but Hugs does not
have it.

The Haskell mailing list will properly answer such questions.

>Another question: in interactive mode, is there a way to write more than a
>line without beeing "evaluated"?

This depends on which version you are using. The MacOS port has unlimited
line width, so just type on. Versions with limited width has (or used to
have) a control character; make sure the input line isn't empty, and try
till you find it.

The Hugs Users mailing list will properly answer such questions.

>Thanks for reading, hope I haven't make you waste time...

Well, we are all experts at wasting time... :-)

  Hans Aberg



Reply via email to