projects
/
matthijs
/
master-project
/
cλash.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
bf59dcf
)
Simplify eitherCoreOrExprArgs.
author
Matthijs Kooijman
<m.kooijman@student.utwente.nl>
Mon, 13 Jul 2009 13:33:37 +0000
(15:33 +0200)
committer
Matthijs Kooijman
<m.kooijman@student.utwente.nl>
Mon, 13 Jul 2009 13:33:37 +0000
(15:33 +0200)
Generate.hs
patch
|
blob
|
history
diff --git
a/Generate.hs
b/Generate.hs
index 4846d58690011e3e3b8d82083feecc67e91c2a19..66dca927241cdca4091c2ead955120991e7207f1 100644
(file)
--- a/
Generate.hs
+++ b/
Generate.hs
@@
-42,17
+42,8
@@
genExprArgs wrap dst func args = do
args' <- eitherCoreOrExprArgs args
wrap dst func args'
args' <- eitherCoreOrExprArgs args
wrap dst func args'
-idM :: a -> VHDLSession a
-idM e = return e
-
-eitherM :: (a -> m c) -> (b -> m c) -> Either a b -> m c
-eitherM f1 f2 e = do
- case e of
- Left e1 -> f1 e1
- Right e2 -> f2 e2
-
eitherCoreOrExprArgs :: [Either CoreSyn.CoreExpr AST.Expr] -> VHDLSession [AST.Expr]
eitherCoreOrExprArgs :: [Either CoreSyn.CoreExpr AST.Expr] -> VHDLSession [AST.Expr]
-eitherCoreOrExprArgs args = mapM (
eitherM (\x -> MonadState.lift vsType $ (varToVHDLExpr (exprToVar x))) idM
) args
+eitherCoreOrExprArgs args = mapM (
Either.either ((MonadState.lift vsType) . varToVHDLExpr . exprToVar) return
) args
-- | A function to wrap a builder-like function that expects its arguments to
-- be variables.
-- | A function to wrap a builder-like function that expects its arguments to
-- be variables.