
Hi there All! I would like to ask: Is it possible for a Haskell program to load code while it's running, in order for it to facilitate the implementation of Plugins? (like it's possible in Perl or Python) Can someone enlighten me, please? Thank You Gilberto

Gilberto Melfe
Hi there All!
I would like to ask: Is it possible for a Haskell program to load code while it's running, in order for it to facilitate the implementation of Plugins? (like it's possible in Perl or Python)
One possible solution is the Haskell `hint` library: http://hackage.haskell.org/package/hint This uses the GHC API to allow you to compile strings into Haskell functions at runtime. This is a lot like `eval` in other languages. - ocharles

On Fri, Feb 21, 2014 at 11:25 AM, Gilberto Melfe
I would like to ask: Is it possible for a Haskell program to load code while it's running, in order for it to facilitate the implementation of Plugins? (like it's possible in Perl or Python)
Can someone enlighten me, please?
There's a plugins package on Hackage for this, but it's something of a pain to use. The whole notion of plugins is kinda at cross-purposes with static type checking. -- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com ballbery@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net

The plugins package is a dying a slow death anyway. (I'm the current
maintainer). The GHC api, with a little bit of glue, seems to replace
everything that current plugins package does -- and better too.
You are correct that loading plugins and static typing are a bit at
odds. If you loading things at runtime, then you have to be willing to
accept that some errors will appear at runtime.
I have developed a generic 'web-plugins' package that supports the
loading of plugins into a running application. The dynamic loading
feature is only proof-of-concept at the moment. But it shows one
system for creating a plugin system,
http://hackage.haskell.org/package/web-plugins-0.2.5/docs/Web-Plugins-Core.h...
I am working on a independent library which adds extra wrappers around
the ghc-api to us fsnotify to watch files and automatically
recompile+reload, or to use cabal to fetch, build, and load plugin
libraries from hackage into a running application. It's not a high
priority at the moment though. I'd be happy to put the current code on
github -- I just need a name. I'm not to fond of the name 'plugins'
because it is a bit more general purpose than that and also doesn't
directly provide plugins support -- just the tools need to create a
plugins framework.
- jeremy
On Fri, Feb 21, 2014 at 10:59 AM, Brandon Allbery
On Fri, Feb 21, 2014 at 11:25 AM, Gilberto Melfe
wrote: I would like to ask: Is it possible for a Haskell program to load code while it's running, in order for it to facilitate the implementation of Plugins? (like it's possible in Perl or Python)
Can someone enlighten me, please?
There's a plugins package on Hackage for this, but it's something of a pain to use. The whole notion of plugins is kinda at cross-purposes with static type checking.
-- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com ballbery@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
participants (4)
-
Brandon Allbery
-
Gilberto Melfe
-
Jeremy Shaw
-
Oliver Charles