blob: 0e24ddf752b2e8b46745d07441e33b66acecfe10 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
(;module:
lux
(lux (codata [io])
(control monad)
(data [text "Text/" Monoid<Text>]
text/format
[number])
(codata function
env))
lux/test)
(test: "lux/codata/env exports"
(test-all (match 123 (run 123 ask))
(match 246 (run 123 (local (i.* 2) ask)))
(match 134 (run 123 (:: Functor<Env> map i.inc (i.+ 10))))
(match 10 (run 123 (:: Applicative<Env> wrap 10)))
(match 30 (run 123 (let [(^open) Applicative<Env>]
(apply (wrap (i.+ 10)) (wrap 20)))))
(match 30 (run 123 (do Monad<Env>
[f (wrap i.+)
x (wrap 10)
y (wrap 20)]
(wrap (f x y)))))))
|