plugins-multistage 0.4.0.1 → 0.5
raw patch · 2 files changed
+12/−13 lines, 2 filesdep −pluginsdep −storable-recorddep −storable-tuple
Dependencies removed: plugins, storable-record, storable-tuple
Files
plugins-multistage.cabal view
@@ -1,5 +1,5 @@ name: plugins-multistage-version: 0.4.0.1+version: 0.5 synopsis: Dynamic linking for embedded DSLs with staged compilation description: Dynamic compilation, linking and loading of functions in staged languages.@@ -26,11 +26,8 @@ System.Plugins.MultiStage build-depends: base >= 4 && < 4.8- , plugins >= 1.5.3 && < 2 , template-haskell , th-expand-syns >= 0.3- , storable-record < 0.1- , storable-tuple < 0.1 hs-source-dirs: src
src/System/Plugins/MultiStage.hs view
@@ -78,16 +78,18 @@ noWorker fun as = normalB $ appsE $ map varE $ fun:as -- | Generic function compiler and loader-loadFunWithConfig :: Config -> Name -> Q [Dec]-loadFunWithConfig conf@Config{..} name = do- typ <- typeFromName name- let base = nameBase name- let cname = mkName $ prefix ++ base- let wname = mkName $ prefix ++ base ++ "_worker"- let args = [mkName $ 'v' : show i | i <- [1..(arity typ)]]- sequence $ declWorker conf wname name args typ- ++ declareWrapper cname wname args typ+loadFunWithConfig :: Config -> [Name] -> Q [Dec]+loadFunWithConfig conf@Config{..} names = fmap concat $ mapM go names where+ go name = do+ typ <- typeFromName name+ let base = nameBase name+ let cname = mkName $ prefix ++ base+ let wname = mkName $ prefix ++ base ++ "_worker"+ let args = [mkName $ 'v' : show i | i <- [1..(arity typ)]]+ sequence $ declWorker conf wname name args typ+ ++ declareWrapper cname wname args typ+ arity :: Type -> Int arity (AppT (AppT ArrowT _) r) = 1 + arity r arity _ = 0