[Haskell] ANNOUNCE: hs-plugins-0.9.2 - dynamically loaded plugins

Donald Bruce Stewart dons at cse.unsw.edu.au
Sun May 16 01:21:16 EDT 2004

     == hs-plugins-0.09.2, dynamically loaded plugins in Haskell ==

Release early, release often is the way to go.

This is the first src release of <hs-plugins>, a library for
compiling and loading Haskell plugins in Haskell.


The library allows an application to compile and load a Haskell source
file, and then run the code therein. The inspiration and foundation of
hs-plugins based on Andre Pang's original runtime_loader code and GHCi
binding. hs-plugins provides this functionality, along with layers of
abstraction on top, as well as a 'make' mechanism to recompile plugins
whose source has changed, and the following features:

        - runtime compilation and re-compilation of plugins
        - runtime loading of object files
        - automatic *dependency* loading of object files, based on .hi info
        - unload/reloading of object files
        - a mechanism to merge the abstract syntax of a plugin with a
          syntax stub, to factor out common/necessary declarations. This
          is to help out EDSL programmers
        - many examples, and a simple build system

An example plugin, potentially written by a non-programmer:
        resource = plugin {
                function = reverse

An example application:
        import Plugins
        import API

        main = do
                make "Plugin.hs" []
                (m,v) <- load "Plugins.o" "." "resource"
                putStrLn $ (function v) "hello"

will print "olleh"

You'll probably need GHC 6.2 or greater. This is a GHCi specific
library, and will only work on platforms with a functional GHCi
implementation. It is also BSD make friendly ;)

The original inspiration was to provide a typesafe config language to
replace configuration files for new applications (a muttrc and vimrc
killer...) Haskell EDSLs and dynloaded plugins suit this quite fine,
and the library is suited for EDSL purposes in general, I think.

Feedback *very* welcome.


-- Don

More information about the Haskell mailing list