plugins-multistage 0.6.1 → 0.6.2
raw patch · 2 files changed
+18/−2 lines, 2 filesdep +ghcidep ~base
Dependencies added: ghci
Dependency ranges changed: base
Files
plugins-multistage.cabal view
@@ -1,5 +1,5 @@ name: plugins-multistage-version: 0.6.1+version: 0.6.2 synopsis: Dynamic linking for embedded DSLs with staged compilation description: Dynamic compilation, linking and loading of functions in staged languages.@@ -25,12 +25,15 @@ exposed-modules: System.Plugins.MultiStage - build-depends: base >= 4 && < 4.9+ build-depends: base >= 4 && < 5.9 , ghc , process , directory , template-haskell , th-desugar++ if impl(ghc >= 8.0.0)+ build-depends: ghci hs-source-dirs: src
src/System/Plugins/MultiStage.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE RecordWildCards #-}@@ -35,7 +36,11 @@ import Debug.Trace import BasicTypes (failed)+#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 800+import GHCi.ObjLink (initObjLinker,loadObj,resolveObjs)+#else import ObjLink (initObjLinker,loadObj,resolveObjs)+#endif import Language.Haskell.TH import Language.Haskell.TH.Desugar@@ -135,7 +140,11 @@ loadFunType name = do info <- reify name case info of+#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 800+ (VarI _ t _) -> return t+#else (VarI _ t _ _) -> return t+#endif _ -> error $ unwords ["loadFun:",show (nameBase name) ,"is not a function:",show info] @@ -198,7 +207,11 @@ initObjLinker _ <- loadObj oname res <- resolveObjs+#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 800+ when (not res) $ error $ "Symbols in " ++ oname ++ " could not be resolved"+#else when (failed res) $ error $ "Symbols in " ++ oname ++ " could not be resolved"+#endif compileC :: String -> String -> [String] -> IO () compileC srcfile objfile opts = do