Idris2/tests/racket/futures001/Futures.idr

24 lines
395 B
Idris
Raw Normal View History

2021-01-13 23:54:43 +03:00
module Futures
import Data.List
import Data.So
import System
import System.Future
import System.Info
constant : IO ()
constant = do
let a = await $ fork "String"
putStrLn a
map : IO ()
map = do
future1 <- forkIO $ do
usleep 10000
putStrLn "#2"
let future3 = map (const "#3") future1
future2 <- forkIO $ do
putStrLn "#1"
pure $ await future2
putStrLn (await future3)