Is it possible to do dynamic loading in Haskell? Let us say you want to have plug-in loadable widgets. You create a widget API, which is in fact a data-type W (which you make an instance of Typeable). You then write an application that loads widgets, using something like this: loadDynamic :: FilePath -> IO Dynamic Someone else could then use your widget API to write code that provides a value of type W (or a Dynamic), and compile and link it as a widget that can then be loaded. Is this possible? -- Ashley Yakeley, Seattle WA
I think hslibs is what you're looking for. /S On Sun, 20 Mar 2005 03:35:09 -0800, Ashley Yakeley <ashley@semantic.org> wrote:
Is it possible to do dynamic loading in Haskell?
Let us say you want to have plug-in loadable widgets. You create a widget API, which is in fact a data-type W (which you make an instance of Typeable). You then write an application that loads widgets, using something like this:
loadDynamic :: FilePath -> IO Dynamic
Someone else could then use your widget API to write code that provides a value of type W (or a Dynamic), and compile and link it as a widget that can then be loaded.
Is this possible?
-- Ashley Yakeley, Seattle WA
_______________________________________________ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell
-- Sebastian Sylvan +46(0)736-818655 UIN: 44640862
ashley:
Is it possible to do dynamic loading in Haskell?
Let us say you want to have plug-in loadable widgets. You create a widget API, which is in fact a data-type W (which you make an instance of Typeable). You then write an application that loads widgets, using something like this:
loadDynamic :: FilePath -> IO Dynamic
Someone else could then use your widget API to write code that provides a value of type W (or a Dynamic), and compile and link it as a widget that can then be loaded.
Is this possible?
You want hs-plugins :) It provides load functions of various flavours, including one similar to the above: dynload :: Typeable a => FilePath -> [FilePath] -> [PackageConf] -> Symbol -> IO (LoadStatus a) (The type is a little more complex due to the need to interact with the module and package system). dynload() unwraps and checks the Dynamic for you. If you want to do this manually, a straight load() will work. http://www.cse.unsw.edu.au/~dons/hs-plugins Cheers, Don
On 20/03/2005, at 10:35 PM, Ashley Yakeley wrote:
Let us say you want to have plug-in loadable widgets. You create a widget API, which is in fact a data-type W (which you make an instance of Typeable). You then write an application that loads widgets, using something like this:
loadDynamic :: FilePath -> IO Dynamic
In a nutshell, yes, you can do this. See: http://www.algorithm.com.au/mt/haskell/ghc_runtime_loading.html for a very primitive module which more-or-less does that. However, what you _really_ want is hs-plugins, Don Stewart's ninja-fu dynamic loader for Haskell, which can do what you want and far, far more. Runtime Haskell evaluation never felt so good: http://www.cse.unsw.edu.au/~dons/hs-plugins/ http://www.cse.unsw.edu.au/~dons/hs-plugins/paper/ -- % Andre Pang : trust.in.love.to.save <http://www.algorithm.com.au/>
participants (4)
-
Andre Pang -
Ashley Yakeley -
dons@cse.unsw.edu.au -
Sebastian Sylvan