Created
July 15, 2013 14:10
-
-
Save co-dan/6000221 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
proxy1 :: (Proxy p) => String -> Server p String Int IO () | |
proxy1 = fromListS [1..] >-> mapU (const ()) >-> useU putStrLn | |
retpmorp :: (Proxy p) => () -> p String () () C IO r | |
retpmorp () = turn $ prompter () | |
prompter :: (Proxy p) => () -> Producer p String IO r | |
prompter () = runIdentityP $ forever $ do | |
lift $ putStr "> " | |
lift $ hFlush stdout | |
n <- lift getLine | |
respond n | |
debugD s = execD (putStrLn s) | |
runit = runProxy $ | |
proxy1 | |
>-> printD | |
>-> mapD (const ()) | |
>-> takeB_ 3 | |
>-> retpmorp | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment