Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

more cleanups

  • Loading branch information...
commit a61c04132359124d81efa9da36bfc6c038582f60 1 parent b8ffe8f
@mwotton authored
View
6 Haskell/Language/Ruby/Hubris/GHCBuild.hs
@@ -27,14 +27,14 @@ withTempFile pattern code = do (name, handle) <- openTempFile "/tmp" pattern
hClose handle
return name
-ghcBuild :: Filename -> String -> String -> [Filename] -> [Filename] -> [String]-> IO (Either String Filename)
-ghcBuild libFile immediateSource modName extra_sources c_sources args =
+ghcBuild :: Filename -> String -> String -> [Filename] -> [String]-> IO (Either String Filename)
+ghcBuild libFile immediateSource modName extra_sources args =
do -- putStrLn ("modname is " ++ modName)
putStrLn immediateSource
haskellSrcFile <- withTempFile "hubris_XXXXX.hs" immediateSource
putStrLn ("ghc is " ++ ghc)
(code, out, err) <- noisySystem ghc $ standardGHCFlags ++ ["-o",libFile,"-optl-Wl,-rpath," ++ libdir,
- haskellSrcFile, "-L" ++ libdir] ++ extra_sources ++ c_sources ++ args
+ haskellSrcFile, "-L" ++ libdir] ++ extra_sources ++ args
return $ case code of
ExitSuccess -> Right libFile
otherCode -> Left $ unlines ["Errcode: " ++show code,"output: " ++ out, "error: " ++ err]
View
7 Haskell/Language/Ruby/Hubris/LibraryBuilder.hs
@@ -34,7 +34,7 @@ generateLib libFile sources moduleName buildArgs packages = do
either (return . Left . show)
(\(c,mod) -> do bindings <- withTempFile "hubris_interface_XXXXX.c" c
- ghcBuild libFile mod ("Language.Ruby.Hubris.Exports." ++ moduleName) sources [bindings] buildArgs)
+ ghcBuild libFile mod ("Language.Ruby.Hubris.Exports." ++ moduleName) sources ([bindings] ++ buildArgs))
s
@@ -47,8 +47,8 @@ callable func = do
ok <- typeChecks str
if not ok
then return Nothing
- else do res <- interpret str (as::Int)
- return $ Just res
+ else Just <$> interpret str (as::Int)
+
where str = "Language.Ruby.Hubris.arity " ++ parens func
@@ -161,7 +161,6 @@ haskellBoilerplate moduleName = unlines ["{-# LANGUAGE ForeignFunctionInterface,
--- wrapper = func ++ " b = (Language.Ruby.Hubris.wrap " ++ moduleName ++ "." ++ func ++ ") b",
genWrapper (func,arity) mod = unlines $ [func ++ " :: " ++ myType
,func ++ " " ++ unwords symbolArgs ++ " = " ++ defHask
,"foreign export ccall \"hubrish_" ++ func ++ "\" " ++ func ++ " :: " ++ myType]
Please sign in to comment.
Something went wrong with that request. Please try again.