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
-- `accepts`, in defunctionalized style: | |
accepts :: State -> String -> Bool | |
accepts S0 ('a':xs) = accepts S1 xs | |
accepts S0 ('b':xs) = accepts S2 xs | |
accepts S1 ('a':xs) = accepts S2 xs | |
accepts S1 ('b':xs) = accepts S0 xs | |
accepts S2 ('a':xs) = accepts S0 xs | |
accepts S2 ('b':xs) = accepts S2 xs | |
accepts S2 _ = True | |
accepts _ _ = False |