blob: 87f155848f37ee9f9b9a6d226059aef4d61f1623 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
(.module:
[library
[lux #*]])
(interface: #export (Monoid a)
{#.doc (doc "A way to compose values."
"Includes an identity value which does not alter any other value when combined with.")}
(: a
identity)
(: (-> a a a)
compose))
(def: #export (compose left right)
(All [l r] (-> (Monoid l) (Monoid r) (Monoid [l r])))
(implementation
(def: identity
[(\ left identity) (\ right identity)])
(def: (compose [lL rL] [lR rR])
[(\ left compose lL lR)
(\ right compose rL rR)])))
|