
stmtFor :: [LispAST] -> Either MidError Statement
stmtFor (var:times:body) =
  For <$> mkExpr var <*> mkExpr times <*> (Do <$> traverse mkStatement body)
stmtFor _ = Left $ InvalidArgumentsFor "for"

stmtWhen :: [LispAST] -> Either MidError Statement
stmtWhen (cond:body) =
  IfElse <$> mkExpr cond <*> (Do <$> traverse mkStatement body) <&> ($ Do [])
stmtWhen _ = Left $ InvalidArgumentsFor "when"

stmtUnless :: [LispAST] -> Either MidError Statement
stmtUnless (cond:body) = do