aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/codata/function.lux
blob: fba5528a86fa8a871af07aa4b973af04b33afcba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
##  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
  (lux (control monoid)))

## [Functions]
(def: #export (const x y)
  (All [a b] (-> a (-> b a)))
  x)

(def: #export (flip f)
  (All [a b c]
    (-> (-> a b c) (-> b a c)))
  (lambda [x y] (f y x)))

## [Structures]
(struct: #export Monoid<Function> (Monoid (All [a] (-> a a)))
  (def: unit id)
  (def: append .))