Created
March 20, 2017 04:54
-
-
Save jkoppel/34d6fccffbbec61d94d9ce3f9cbda5c6 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
data Exp = Lit String | |
pprint :: Exp -> String | |
pprint = (\(Lit s) -> a ++ "'" ++ s ++ "'") where a free | |
pprint = (\(Lit s) -> a ++ "\"" ++ s ++ "\"") where a free | |
parse :: String -> (Exp, Exp -> String) | |
parse s | s =:= f x = (x, f) | |
where | |
f = pprint | |
x free |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ilp> snd (parse "this_is_deleted 'hello'") (Lit "Goodbye")
"this_is_deleted 'Goodbye'"