Skip to content

Instantly share code, notes, and snippets.

@jkoppel
Created March 20, 2017 04:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jkoppel/34d6fccffbbec61d94d9ce3f9cbda5c6 to your computer and use it in GitHub Desktop.
Save jkoppel/34d6fccffbbec61d94d9ce3f9cbda5c6 to your computer and use it in GitHub Desktop.
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
@jkoppel
Copy link
Author

jkoppel commented Mar 20, 2017

ilp> snd (parse "this_is_deleted 'hello'") (Lit "Goodbye")
"this_is_deleted 'Goodbye'"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment