Skip to content

Instantly share code, notes, and snippets.

@shhyou
Last active December 15, 2015 04:50
Show Gist options
  • Save shhyou/5204636 to your computer and use it in GitHub Desktop.
Save shhyou/5204636 to your computer and use it in GitHub Desktop.
CPS transformed version of match0n1n-1.hs
-- The CPS-transformed version of match.
-- https://gist.github.com/suhorng/5204442
match' :: String -> Bool
match' s = trace s null
where trace :: String -> (String -> Bool) -> Bool
trace ('0':xs) k = trace xs $ \remainString ->
case remainString of
'1':xs' -> k xs'
_ -> False
trace xs k = k xs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment