GHCi grumbles (2)

Marcin 'Qrczak' Kowalczyk
15 Aug 2001 18:04:16 GMT

Wed, 15 Aug 2001 17:33:02 +0100, Simon Marlow <> pisze:

> It's hard to do, unless you adopt a policy such as ending the current
> input with ';', which doesn't seem terribly attractive.  The right way
> to do it is for the parser to be incremental and interact with readline,
> but I can't see an easy way to do that.

And it's not clear when a multi-line expression ends, e.g.
    case foo of
        1 -> xxx
        2 -> yyy
        3 -> zzz

Python uses the convention that an empty line entered interactively
ends a multiline statement. Its syntax is different from Haskell
in that it can be determined when a statement is multiline from the
first line, and that it's not possible to write certain statements
in a single line - so for Python it's more important to be able to
enter multiline statements.

What is a pain in Python: repeating a whole multiline statement
(because, say, of an error in the middle made previously) requires
bringing each line from history separately.

Some Unix shells are different and bring the whole multiline statement
from the history, providing a substitute of a full-screen editor,
with the main surprises being that Enter executes the statement and
up/down arrows typically don't work either.

In zsh pressing End at the end of a line, or Home at the beginning,
allows to go up and down through lines, and Alt-Enter or Ctrl-V Ctrl-J
allow to insert a newline character.

 __("<  Marcin Kowalczyk *
  ^^                      SYGNATURA ZASTĘPCZA