aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/control/functor.lux
blob: 5c76ba76ad8a7d14a9dc7c36a86dd6399c68922d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
##  Copyright (c) Eduardo Julian. All rights reserved.
##  This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
##  If a copy of the MPL was not distributed with this file,
##  You can obtain one at http://mozilla.org/MPL/2.0/.

(;module: lux)

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

(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)))