diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux/abstract/equivalence.lux | 9 | ||||
-rw-r--r-- | stdlib/source/lux/abstract/functor.lux | 6 | ||||
-rw-r--r-- | stdlib/source/lux/abstract/functor/contravariant.lux | 8 | ||||
-rw-r--r-- | stdlib/source/lux/abstract/order.lux | 13 | ||||
-rw-r--r-- | stdlib/source/lux/abstract/predicate.lux | 9 |
5 files changed, 25 insertions, 20 deletions
diff --git a/stdlib/source/lux/abstract/equivalence.lux b/stdlib/source/lux/abstract/equivalence.lux index ccfc55928..d65e101a8 100644 --- a/stdlib/source/lux/abstract/equivalence.lux +++ b/stdlib/source/lux/abstract/equivalence.lux @@ -1,7 +1,8 @@ (.module: [lux #*] [// - [functor (#+ Contravariant)]]) + [functor + ["." contravariant]]]) (signature: #export (Equivalence a) {#.doc "Equivalence for a type's instances."} @@ -35,10 +36,10 @@ (def: (= left right) (sub = left right)))) -(structure: #export contravariant - (Contravariant Equivalence) +(structure: #export functor + (contravariant.Functor Equivalence) - (def: (map-1 f equivalence) + (def: (map f equivalence) (structure (def: (= reference sample) (:: equivalence = (f reference) (f sample)))))) diff --git a/stdlib/source/lux/abstract/functor.lux b/stdlib/source/lux/abstract/functor.lux index a9fc6796c..9ba47aaf8 100644 --- a/stdlib/source/lux/abstract/functor.lux +++ b/stdlib/source/lux/abstract/functor.lux @@ -42,9 +42,3 @@ (structure (def: (map f fga) (f@map (g@map f) fga)))) - -(signature: #export (Contravariant f) - (: (All [a b] - (-> (-> b a) - (-> (f a) (f b)))) - map-1)) diff --git a/stdlib/source/lux/abstract/functor/contravariant.lux b/stdlib/source/lux/abstract/functor/contravariant.lux new file mode 100644 index 000000000..79ae218fa --- /dev/null +++ b/stdlib/source/lux/abstract/functor/contravariant.lux @@ -0,0 +1,8 @@ +(.module: + [lux #*]) + +(signature: #export (Functor f) + (: (All [a b] + (-> (-> b a) + (-> (f a) (f b)))) + map)) diff --git a/stdlib/source/lux/abstract/order.lux b/stdlib/source/lux/abstract/order.lux index c28026036..dad99b8b4 100644 --- a/stdlib/source/lux/abstract/order.lux +++ b/stdlib/source/lux/abstract/order.lux @@ -3,8 +3,9 @@ [control ["." function]]] [// - [functor (#+ Contravariant)] - ["." equivalence (#+ Equivalence)]]) + ["." equivalence (#+ Equivalence)] + [functor + ["." contravariant]]]) (signature: #export (Order a) {#.doc "A signature for types that possess some sense of ordering among their elements."} @@ -44,13 +45,13 @@ Choice (if (:: order < y x) y x)) -(structure: #export contravariant - (Contravariant Order) +(structure: #export functor + (contravariant.Functor Order) - (def: (map-1 f order) + (def: (map f order) (structure (def: &equivalence - (:: equivalence.contravariant map-1 f (:: order &equivalence))) + (:: equivalence.functor map f (:: order &equivalence))) (def: (< reference sample) (:: order < (f reference) (f sample)))))) diff --git a/stdlib/source/lux/abstract/predicate.lux b/stdlib/source/lux/abstract/predicate.lux index b69b43415..13aa9a083 100644 --- a/stdlib/source/lux/abstract/predicate.lux +++ b/stdlib/source/lux/abstract/predicate.lux @@ -4,7 +4,8 @@ ["." function]]] [// [monoid (#+ Monoid)] - [functor (#+ Contravariant)]]) + [functor + ["." contravariant]]]) (type: #export (Predicate a) (-> a Bit)) @@ -52,8 +53,8 @@ (function (recur input) (predicate recur input))) -(structure: #export contravariant - (Contravariant Predicate) +(structure: #export functor + (contravariant.Functor Predicate) - (def: (map-1 f fb) + (def: (map f fb) (|>> f fb))) |