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

Leif Frenzel himself at leiffrenzel.de
Thu Nov 22 15:03:34 EST 2007

> I'm not 100% sure, but I think hsplugins can dynamically load compiled 
> *.o files in this way. 

>Not sure whether this requires the person running 
> the main program to have GHC installed though.
Yes, it does.

Thanks && ciao,

> Unlike Java, there's no reflection capabilities. This isn't too bad 
> though; just write your own class definition to allow your main program 
> to query the thing it just loaded and find out what it offers.
>  class Describable d where
>    available_functions :: d -> [FunctionInfo]
>  data FunctionInfo = FunctionInfo {name :: String, description :: 
> String, ...}
> Unlike general reflection (where you try to guess things from function 
> names and so on), this can be taylored to exactly the kind of plugins 
> you're trying to write.
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

More information about the Haskell-Cafe mailing list