X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=Generate.hs;h=66dca927241cdca4091c2ead955120991e7207f1;hb=4eb5c11261fbaab7dea9aee26a45989f9616366e;hp=4846d58690011e3e3b8d82083feecc67e91c2a19;hpb=bf59dcfb13123d9ce146742e15e7b1a128d9c4e9;p=matthijs%2Fmaster-project%2Fc%CE%BBash.git 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.