From 6f2707125f9f2c087952a6a52fd5ea6f49a99cef Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Mon, 13 Jul 2009 15:33:37 +0200 Subject: [PATCH] Simplify eitherCoreOrExprArgs. --- Generate.hs | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/Generate.hs b/Generate.hs index 4846d58..66dca92 100644 --- a/Generate.hs +++ b/Generate.hs @@ -42,17 +42,8 @@ genExprArgs wrap dst func args = do 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 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. -- 2.30.2