Main module editor/Interpreter

Eric Allen Wohlstadter
Fri, 19 Oct 2001 14:20:36 -0700 (PDT)

Has anyone made a program for Hugs that allows you to add type definitions
and top level functions to the Main module from the interpreter command
line? I find it odd that I have load from a text file to experiment with
data types, classes, etc. If this sort of thing is not available convince
me either to: a) write one myself or b) don't waste my time.

This is what a session might look like:
Main> data List a = Cons a | Nil deriving Show
-- type constructor
data List a

-- constructors:
Cons :: a -> List a -> List a
Nil :: List a

-- instances:
instance Show a => Show (List a)

Main> (Cons (Cons 4 Nil) Nil)
Cons (Cons 4 Nil) Nil

Main> data List = Dummy
-- type constructor
data List

-- constructors:
Dummy :: List

Main> (Cons 4 Nil)
ERROR - Undefined constructor function "Nil"

	Eric Wohlstadter
	UCDavis Software Tools Lab