Instantly share code, notes, and snippets.

Embed
What would you like to do?
Hello world.
import Streaming
import qualified Streaming.Prelude as S
import Control.Monad
main = do
S.effects (hilo 30 )
putStrLn "Right, 30 is correct!"
hilo :: Int -> Stream (Of Int) IO ()
hilo n = void $ S.break (== n)
$ S.chain (\a -> when (a < n) $ putStrLn $ "Too small!")
$ S.chain (\a -> when (a > n) $ putStrLn $ "Too big!")
$ S.map snd
$ S.zip (S.cycle $ do lift (putStrLn "\nEnter a number")
S.yield ())
$ S.delay 0.1
$ S.readLn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment