[luca_ciciriello@hotmail.com: Re: [Haskell-beginners] reflection]

Luca Ciciriello luca_ciciriello at hotmail.com
Tue Jan 5 13:02:58 EST 2010


Brent, thanks for your precious help.

Luca
On Jan 5, 2010, at 6:41 PM, Brent Yorgey wrote:

> Well, there are a few things I could suggest for you to look at:
> 
>  * the hint package [1] for runtime Haskell interpretation
>  * look at xmonad [2] for an example of a program which recompiles and reloads itself on the fly
>  * the haskell-src-exts library [3] 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.
> 
> -Brent
> 
> [1] http://hackage.haskell.org/package/hint
> [2] http://xmonad.org/
> [3] http://hackage.haskell.org/package/haskell-src-exts
> 
> ----- 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.
> 
> Luca.
> 
> 
> On Jan 5, 2010, at 5:58 PM, Brent Yorgey wrote:
> 
>> On Tue, Jan 05, 2010 at 09:43:21AM +0100, Luca Ciciriello wrote:
>>> Hi.
>>> 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.
>> 
>> -Brent
>> _______________________________________________
>> Beginners mailing list
>> Beginners at haskell.org
>> http://www.haskell.org/mailman/listinfo/beginners
>> 
> 
> 
> 
> ----- End forwarded message -----
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
> 



More information about the Beginners mailing list