aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/abstract/monoid.lux
blob: 6e8aff164e55e382f1ccc5c3f3027772872019f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
(.module:
  [library
   [lux (#- and)]])

(interface: .public (Monoid a)
  (: a
     identity)
  (: (-> a a a)
     composite))

(def: .public (and left right)
  (All [l r] (-> (Monoid l) (Monoid r) (Monoid [l r])))
  (implementation
   (def: identity
     [(\ left identity) (\ right identity)])
   
   (def: (composite [lL rL] [lR rR])
     [(\ left composite lL lR)
      (\ right composite rL rR)])))