forked from purescript-deprecated/purescript-eff
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEff.lua
More file actions
63 lines (54 loc) · 970 Bytes
/
Eff.lua
File metadata and controls
63 lines (54 loc) · 970 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
-- module Control.Monad.Eff
local Control_Monad_Eff = {}
Control_Monad_Eff.pureE = function (a)
return function ()
return a
end
end
Control_Monad_Eff.bindE = function (a)
return function (f)
return function ()
return f(a())()
end
end
end
Control_Monad_Eff.runPure = function (f)
return f()
end
Control_Monad_Eff.untilE = function (f)
return function ()
while not f() do end
return {}
end
end
Control_Monad_Eff.whileE = function (f)
return function (a)
return function ()
while f() do
a()
end
return {}
end
end
end
Control_Monad_Eff.forE = function (lo)
return function (hi)
return function (f)
return function ()
for i = lo, hi do
f(i)()
end
end
end
end
end
Control_Monad_Eff.foreachE = function (as)
return function (f)
return function ()
for i = 0, #as do
f(as[i])()
end
end
end
end
return Control_Monad_Eff