aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/control/functor.lux
blob: 416223cd74a965c431de7ea35aec5eb36277cbfc (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
(;module: lux)

(sig: #export (Functor f)
  (: (All [a b]
       (-> (-> a b) (f a) (f b)))
     map))

(type: #export (Fix f)
  (f (Fix f)))

(type: #export (<&> f g)
  (All [a] (& (f a) (g a))))

(type: #export (<|> f g)
  (All [a] (| (f a) (g a))))

(type: #export (<.> f g)
  (All [a] (f (g a))))

(struct: #export (compF Functor<F> Functor<G>)
  {#;doc "Functor composition."}
  (All [F G] (-> (Functor F) (Functor G) (Functor (All [a] (F (G a))))))
  (def: (map f fga)
    (:: Functor<F> map (:: Functor<G> map f) fga)))