aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/data/identity.lux
blob: 521f66e3e3cabab2c5e231b5bbe42e23291bb2f2 (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
(.module:
  [library
   [lux #*
    [abstract
     [functor (#+ Functor)]
     [apply (#+ Apply)]
     [monad (#+ Monad)]
     [comonad (#+ CoMonad)]]
    [control
     ["." function]]]])

(type: #export (Identity a)
  a)

(implementation: #export functor
  (Functor Identity)

  (def: map function.identity))

(implementation: #export apply
  (Apply Identity)

  (def: &functor ..functor)
  (def: (apply ff fa) (ff fa)))

(implementation: #export monad
  (Monad Identity)
  
  (def: &functor ..functor)
  (def: in function.identity)
  (def: join function.identity))

(implementation: #export comonad
  (CoMonad Identity)
  
  (def: &functor ..functor)
  (def: out function.identity)
  (def: split function.identity))