[Haskell-cafe] Dynamically find out instances of classes (pluginsystem for haskell)

Bayley, Alistair Alistair_Bayley at invescoperpetual.co.uk
Thu Nov 22 04:29:31 EST 2007


> From: haskell-cafe-bounces at haskell.org 
> [mailto:haskell-cafe-bounces at haskell.org] On Behalf Of 
> Radoslaw Grzanka
> 
> Hi,
>   Is there any plugin system for haskell? For example, in Java, I can
> load all compiled classes from given directory, check their interfaces
> and run some methods through reflection etc. Is it possible in
> haskell, to load modules from given directory, and if in module there
> is instance of class then return instantiation of that class?

There are two libs that I'm aware of.

  http://hackage.haskell.org/cgi-bin/hackage-scripts/package/plugins-1.0
 
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/metaplug-0.1.
1

AFAICT, plugins is more mature and has a higher-level API, but the last
time I looked it was not working on Windows under ghc >= 6.6 (can anyone
refute or verify this?)

It's more like dynamic linking than Java's reflection: you have to
already know what functions are in the module (and their types) to be
able to call them. I'm not sure about directly creating values of data
types exported from the module.

Alistair
*****************************************************************
Confidentiality Note: The information contained in this message,
and any attachments, may contain confidential and/or privileged
material. It is intended solely for the person(s) or entity to
which it is addressed. Any review, retransmission, dissemination,
or taking of any action in reliance upon this information by
persons or entities other than the intended recipient(s) is
prohibited. If you received this in error, please contact the
sender and delete the material from any computer.
*****************************************************************


More information about the Haskell-Cafe mailing list