Interpret haskell within haskell.

Simon Marlow simonmar@microsoft.com
Fri, 20 Dec 2002 10:04:39 -0000


> I was wondering if there is any project that aims to
> interpret haskell within haskell.
>=20
> Is it feasable that a program can import a user's .hs
> file that has something like:
>=20
> greeting :: String
> greeting =3D "Something"
>=20
> port :: Int
> port =3D 32 + 33
>=20
> And the program can parse and execute the user's
> function.
>=20
> I'm looking for something similar to the eval command
> in Python.

You could potentially do this with GHCi, but we haven't tried.  The idea
is that you would need to expose parts of GHCi itself as a library which
can be used from the program.  Linking is a bit tricky (you don't want
to load another copy of GHCi), but we know one way to get around that:
the --export-dynamic flag to ld.

If you're interested in having a go, come on over to
glasgow-haskell-users@haskell.org and we'll help out with any problems
you run into.

Cheers,
	Simon