aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/data/identity.lux
blob: 55e942681699b26d4c125d28599e51d79a2b3231 (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
38
39
(.using
 [library
  [lux (.except)
   [abstract
    [functor (.only Functor)]
    [apply (.only Apply)]
    [monad (.only Monad)]
    [comonad (.only CoMonad)]]
   [control
    ["[0]" function]]]])

(type: .public (Identity a)
  a)

(def: .public functor
  (Functor Identity)
  (implementation
   (def: each function.identity)))

(def: .public apply
  (Apply Identity)
  (implementation
   (def: functor ..functor)
   (def: (on fa ff)
     (ff fa))))

(def: .public monad
  (Monad Identity)
  (implementation
   (def: functor ..functor)
   (def: in function.identity)
   (def: conjoint function.identity)))

(def: .public comonad
  (CoMonad Identity)
  (implementation
   (def: functor ..functor)
   (def: out function.identity)
   (def: disjoint function.identity)))