git.iko.soy/rowtype-yoga/purescript-backend-optimizer
on main help sign in
33 lines 705 B history raw
1module Snapshot.EffectLoops01 where
3import Prelude
5import Effect (Effect, foreachE)
6import Effect.Class.Console as Console
8test1 :: (Int -> Array Int) -> Effect Unit
9test1 k =
10 foreachE (k 42) \a -> do
11 Console.logShow a
12 Console.logShow a
14test2 :: (Int -> Array Int) -> Effect Unit
15test2 k = do
16 foreachE (k 42) \a -> Console.logShow a
17 foreachE (k 42) Console.logShow
18 foreachE (k 42) (const (Console.log "wat"))
20test3 :: Array Int -> Effect Unit
21test3 arr =
22 foreachE arr \a ->
23 when (a < 10) do
24 Console.logShow a
26test4 :: Array Int -> Effect Unit
27test4 arr =
28 foreachE arr \a ->
29 void $
30 if a < 10 then
31 Console.logShow a
32 else
33 Console.log "wat"