Created
January 20, 2017 20:18
-
-
Save deque-blog/19249732fe7d18d3b8aae06fa7b338b2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
prn :: Expr -> String | |
prn = cata algebra where | |
algebra (Cst n) = show n | |
algebra (Var x) = x | |
algebra (Op Add xs) = "(+ " ++ unwords xs ++ ")" | |
algebra (Op Mul xs) = "(* " ++ unwords xs ++ ")" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment