X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=Generate.hs;fp=Generate.hs;h=f4cab36460d4f1b1b9e39ce5dc8819a582c68102;hb=149fc422a264f8cbb90af36e3f4926977bdcf35b;hp=1af1be33a63c977b0e5630f2fd32c0dec097efc5;hpb=03b96c164e75ab3af5887a4cb498759370a31100;p=matthijs%2Fmaster-project%2Fc%CE%BBash.git diff --git a/Generate.hs b/Generate.hs index 1af1be3..f4cab36 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.