blob: 7eea70f7aaf4e588a9a0aa0ac2abe2f9c1933be7 (
plain)
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
|
(.module:
[lux #*
[control
["M" monad (#+ do Monad)]]
[data
bit]
[math
["r" random]]]
lux/test)
(context: "Bit operations."
(<| (times +100)
(do @
[value r.bit]
(test "" (and (not (and value (not value)))
(or value (not value))
(not (:: Or@Monoid<Bit> identity))
(:: Or@Monoid<Bit> compose value (not value))
(:: And@Monoid<Bit> identity)
(not (:: And@Monoid<Bit> compose value (not value)))
(:: Equivalence<Bit> = value (not (not value)))
(not (:: Equivalence<Bit> = value (not value)))
(not (:: Equivalence<Bit> = value ((complement id) value)))
(:: Equivalence<Bit> = value ((complement not) value))
(case (|> value
(:: Codec<Text,Bit> encode)
(:: Codec<Text,Bit> decode))
(#.Right dec-value)
(:: Equivalence<Bit> = value dec-value)
(#.Left _)
#0)
)))))
|