Skip to content

Instantly share code, notes, and snippets.

@LukasPietzschmann
Last active November 10, 2023 17:41
Show Gist options
  • Save LukasPietzschmann/86b2c90d2fe904a9e2fad3e8faf84e03 to your computer and use it in GitHub Desktop.
Save LukasPietzschmann/86b2c90d2fe904a9e2fad3e8faf84e03 to your computer and use it in GitHub Desktop.
A possible definition of foldAST for exercise A f)
foldAST :: (Name -> Op -> Name -> a) -> (Name -> a) -> ([Argument] -> a -> a) -> AST -> a
foldAST fb fv ff = f
where f (BinExpr n1 o n2) = fb n1 o n2
f (Variable n) = fv n
f (Function ps a) = ff ps $ f a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment