[Haskell-beginners] evaluation of expressions [was Re: eval
andrew at swclan.homelinux.org
Mon Oct 27 23:25:20 EDT 2008
On Mon, Oct 27, 2008 at 07:45:26PM -0400, Brent Yorgey wrote:
> On Mon, Oct 27, 2008 at 07:00:00PM -0400, Brandon S. Allbery KF8NH wrote:
> > On 2008 Oct 27, at 17:33, Alex Shearn wrote:
> >> Hey all - I've been trying to write an IRC bot following the guide on the
> >> wiki, and we (those of us on the channel) were trying to get it to
> >> evaluate commands.
> >> So far, we have this for "eval" stuff, but is there anyway to specify a
> >> "parse in haskell" sort of thing?
> > No, although you could fake it with the GHC-API (which basically means your
> > bot has all of GHC built into it).
> > In any case, that's not really a good idea; consider what damage could be
> > done by arbitrary code. A better idea is to link the code into a small
> > program with a very restricted environment and run that with a timeout.
> > See http://code.haskell.org/lambdabot/Plugin/Eval.hs.
> Brandon is right that this is difficult and tricky -- but fortunately,
> someone else has already done the hard work for you! Take a look at
> the mueval package , which should allow you to do what you want.
this raises a question for me, being a bit of a schemer. Is there any
parallel in haskell to the data is code model of the lisp family? For
example, playing around in scheme with a symbolic differentiator, it
is trivial to then evaluate the differentiated s-expression at
arbitrary value by representing the expression, and it's derivative as
a regular scheme expression.
Is this something that can be done in haskell? My initial impression
is no, that you'd have to parse it as an expression and evaluate it as
you would in regular imperative languages. I'd love to hear otherwise.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 197 bytes
Desc: Digital signature
Url : http://www.haskell.org/pipermail/beginners/attachments/20081027/9103e5ea/attachment.bin
More information about the Beginners