[Haskell-cafe] Dynamically find out instances of classes
(pluginsystem for haskell)
claus.reinke at talk21.com
Thu Nov 22 07:28:34 EST 2007
> 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?
> I hope this is understandable what I'm trying to achieve here.
not really: the only classes in haskell are type classes, and
if there is any class instance missing at compile time, you
won't even get to runtime, so you don't have to worry
about loading instances at runtime!-)
perhaps you could describe the problem you are trying
to solve, rather than the solution you would like to see?
in general, ghci and hugs allow you to browse your modules,
find out types and names, run tests, etc. ghci can be scripted
to some extent (not always comfortably, but possibly sufficient
if you only want to find and run all functions named test*, for
instance), and if that isn't enough, ghc has an api that allows
you to program your own variant of ghci, among other things.
More information about the Haskell-Cafe