Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module Main where
- import System.IO
- {-
- main :: IO ()
- -- Idealy i would like to make the main function non blocking
- main = do
- s <- getContents
- putStrLn s -- main is blocking here because putStrLn is handling an infinite list
- putStrLn "Please print me" -- how to execute this while line above is waiting for input
- -}
- -- this way
- import Control.Concurrent
- main :: IO ()
- main = do
- forkIO $ do putStrLn "Please print me"
- s <- getContents
- putStrLn s
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement