Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

minor style cleanup

  • Loading branch information...
commit 512e2bf82086e4229360dabe1e745ab6fc3b7d2b 1 parent f238ed7
@mwotton authored
View
10 Haskell/Language/Ruby/Hubris/LibraryBuilder.hs
@@ -31,10 +31,12 @@ generateLib libFile sources moduleName buildArgs packages = do
GHC.parseStaticFlags $ map noLoc $ map ("-package "++) ("hubris":packages)
s <- generateSource sources moduleName
- case s of
- Right (c,mod) -> do bindings <- withTempFile "hubris_interface_XXXXX.c" c
- ghcBuild libFile mod ("Language.Ruby.Hubris.Exports." ++ moduleName) sources [bindings] buildArgs
- Left x -> return . Left $ show x
+
+ 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)
+ s
+
type Funcname = String
type Wrapper = String
View
4 Haskell/Language/Ruby/Wrappers.hs
@@ -7,9 +7,7 @@ data RValue = T_FIXNUM Int
deriving (Eq, Show,Ord)
wrap :: (Haskellable a, Rubyable b) => (a->b) -> (RValue -> RValue)
-wrap func ar = case (toHaskell ar) of
- Just a -> toRuby $ func a
- Nothing -> T_NIL
+wrap func ar = maybe T_NIL (toRuby . func) (toHaskell ar)
class Haskellable a where
toHaskell :: RValue -> Maybe a
Please sign in to comment.
Something went wrong with that request. Please try again.