Skip to content

Instantly share code, notes, and snippets.

@worldsayshi
worldsayshi / DynLoad.hs
Last active February 25, 2022 15:01 — forked from jhartikainen/DynLoad.hs
Example for loading Haskell source code dynamically using the GHC api
-----------------------------------------------------------------------------
-- | Example for loading Haskell source code dynamically using the GHC api
-- Tested on ghc 7.4.2
--
-- Useful links:
-- GHC api:
-- http://www.haskell.org/ghc/docs/latest/html/libraries/ghc/GHC.html
-- Wiki:
-- http://www.haskell.org/haskellwiki/GHC/As_a_library
-----------------------------------------------------------------------------
{-# LANGUAGE ScopedTypeVariables #-}
module Blog.DynLoad (
loadSourceGhc,
execFnGhc
) where
{-
Source:
http://codeutopia.net/blog/2011/08/20/adventures-in-haskell-dynamic-loading-and-compiling-of-modules/
https://gist.github.com/jhartikainen/1158986