Created
July 24, 2009 18:42
-
-
Save miaout17/154472 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
type MockIO = State MockIOData | |
instance CharIO MockIO where | |
getCh = do | |
d <- get | |
case d of | |
MockIOData (i:is) o -> do | |
put $ MockIOData is o | |
return $ Just i | |
MockIOData [] _ -> | |
return Nothing | |
putCh c = modify $ \s -> s{moOutput = moOutput s ++ [c]} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment