Skip to content

Instantly share code, notes, and snippets.

@artemisSystem
Created August 16, 2020 20:36
Show Gist options
  • Save artemisSystem/6a5b16cf754c65029f7682eacbf76967 to your computer and use it in GitHub Desktop.
Save artemisSystem/6a5b16cf754c65029f7682eacbf76967 to your computer and use it in GitHub Desktop.
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