on e560d91 help sign in
streamly/examples/echo-loop.hs
18 lines 396 B history raw
1import Control.Monad.IO.Class (liftIO)
2import Data.Monoid ((<>))
4import Asyncly (AsyncT, runAsyncly)
6input :: AsyncT IO String
7input = do
8 string <- liftIO getLine
9 return string <> input
11output :: AsyncT IO String -> AsyncT IO ()
12output strings = do
13 s <- strings
14 liftIO $ putStrLn s
16main = do
17 putStrLn "Type something and press enter, repeat"
18 runAsyncly $ output input