Simple compiler question

Chris Webb
25 Jul 2001 19:54:04 +0100

Mark Carroll <> writes:

> Do any of the decent Haskell compilers allow you to just type function
> definitions at an interpreter prompt and use them in subsequent
> interactions, as you'd expect from a Lisp environment? I'm fed up of
> editing a tiny file separately and typing :reload each time, etc.

GHCi (part of GHC >= 5.00) allows you to use let to bind expressions at
the prompt. E.g. you can do something like

  Prelude> let foo n = sum [1..n]
  Prelude> foo 1000

which I agree with you is a very handy thing to be able to do. :-)