interpreter features

S.D.Mechveliani mechvel@math.botik.ru
Tue, 30 Oct 2001 09:46:14 +0300


Eray Ozkural <erayo@cs.bilkent.edu.tr> writes


> Still, having come from that realm of old-school-AI-language-interpreters I
> have difficulty using GHCi because I can't define functions interactively.
> Would it be possible to introduce a mode to do that?
> [..]
> and perhaps going into "interactive" modules which would be separate
> namespaces.
>
> And if LISP can do it, why can't you? ;)
> [..]


The following works in  ghc-5.02:

  ghci 
  ...
  Prelude> let {g:: Integer->Integer;  g 0 = 0;  g n = n+(g $ pred n)}
  Prelude> g 0
  0
  Prelude> g 3
  6

But        Prelude> let {type T = Int;  n = 1 :: T}
does not. 
I wonder, whether there is any good reason for such distinction.

I would like too Haskell to behave like a good interpreter, with 
self-applicability, dynamic features, like, maybe, some Lisp
systems do.

-----------------
Serge Mechveliani
mechvel@botik.ru