[email@example.com: Re: [Haskell-beginners] reflection]
byorgey at seas.upenn.edu
Tue Jan 5 12:41:12 EST 2010
Well, there are a few things I could suggest for you to look at:
* the hint package  for runtime Haskell interpretation
* look at xmonad  for an example of a program which recompiles and reloads itself on the fly
* the haskell-src-exts library  for a full-featured Haskell parser/pretty printer
There is no way to actually inspect and modify the structure of a
running Haskell program in memory; it is simply not stored in a format
which would let you do this (it is highly optimized and compiled).
However, using the above tools I imagine you should be able to
accomplish what you want.
----- Forwarded message from Luca Ciciriello <luca_ciciriello at hotmail.com> -----
From: Luca Ciciriello <luca_ciciriello at hotmail.com>
Date: Tue, 5 Jan 2010 18:20:13 +0100
To: Brent Yorgey <byorgey at seas.upenn.edu>
Subject: Re: [Haskell-beginners] reflection
My need is to have a program that at run-time should be able to read itself and eventually modify itself. I've used this reflection in Common LISP.
I don't know if this is possible in Haskell using GHC or GHCi (perhaps there are more chances inside the eval-loop of GHCi).
Thanks anyway for the answer.
On Jan 5, 2010, at 5:58 PM, Brent Yorgey wrote:
> On Tue, Jan 05, 2010 at 09:43:21AM +0100, Luca Ciciriello wrote:
>> Someone has performed or know how to use reflection in Haskell?
>> I've found something on google, but that stuff seems to me very confusing.
> It depends what you mean by "reflection". Can you give an example of
> the sorts of things you'd like to do? Generally speaking, Haskell
> doesn't support "reflection" in the same way as many other languages
> do, but there are usually idiomatic ways to accomplish the same things
> you would use reflection for.
> Beginners mailing list
> Beginners at haskell.org
----- End forwarded message -----
More information about the Beginners