Created
August 16, 2020 20:36
-
-
Save artemisSystem/6a5b16cf754c65029f7682eacbf76967 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main where | |
import Prelude | |
import Data.Tuple.Nested | |
import Control.Monad.Cont.Trans | |
import Control.Parallel | |
import Effect (Effect) | |
import Effect.Console (log) | |
import Effect.Timer | |
main :: Effect Unit | |
main = runContT ex (\s -> log $ "Done: " <> show s) | |
ex ∷ ContT Unit Effect (Int /\ Int) | |
ex = sequential ado | |
a ← parallel $ ContT \k → ado | |
setTimeout 500 (k 500) | |
setTimeout 2000 (k 2000) | |
in unit | |
b ← parallel $ ContT \k → ado | |
setTimeout 1500 (k 1500) | |
setTimeout 1000 (k 1000) | |
in unit | |
in a /\ b |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment