SHARE
TWEET

Untitled

a guest Mar 25th, 2019 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module Main where
  2.  
  3. import System.IO
  4.  
  5. {-
  6. main :: IO ()
  7. -- Idealy i would like to make the main function non blocking
  8. main = do
  9.     s <- getContents
  10.     putStrLn s                 -- main is blocking here because putStrLn is handling an infinite list
  11.     putStrLn "Please print me" -- how to execute this while line above is waiting for input
  12. -}
  13.  
  14. -- this way
  15.  
  16. import Control.Concurrent
  17.  
  18. main :: IO ()
  19.  
  20. main = do
  21.     forkIO $ do putStrLn "Please print me"
  22.     s <- getContents
  23.     putStrLn s
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top