mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-26 13:11:30 +03:00
bd683938bf
Co-authored-by: Guillaume ALLAIS <guillaume.allais@ens-lyon.org>
24 lines
395 B
Idris
24 lines
395 B
Idris
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)
|