Browse files

minor style cleanup

  • Loading branch information...
1 parent f238ed7 commit 512e2bf82086e4229360dabe1e745ab6fc3b7d2b @mwotton committed Jan 6, 2013
Showing with 7 additions and 7 deletions.
  1. +6 −4 Haskell/Language/Ruby/Hubris/LibraryBuilder.hs
  2. +1 −3 Haskell/Language/Ruby/Wrappers.hs
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

0 comments on commit 512e2bf

Please sign in to comment.