diff options
author | Eduardo Julian | 2017-10-11 17:10:44 -0400 |
---|---|---|
committer | Eduardo Julian | 2017-10-11 17:10:44 -0400 |
commit | 737a4820b130c966615a93243b65463d04a0322d (patch) | |
tree | a42a8b18c803481572a6810871c872bded8de3be | |
parent | 6608f998bca38022af2ebe4f7557f20b20f58acf (diff) |
- Added monoid composition.
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux/control/monoid.lux | 10 | ||||
-rw-r--r-- | stdlib/source/lux/data/bool.lux | 2 | ||||
-rw-r--r-- | stdlib/source/lux/data/coll/list.lux | 2 | ||||
-rw-r--r-- | stdlib/source/lux/data/number.lux | 2 | ||||
-rw-r--r-- | stdlib/source/lux/data/text.lux | 2 |
5 files changed, 13 insertions, 5 deletions
diff --git a/stdlib/source/lux/control/monoid.lux b/stdlib/source/lux/control/monoid.lux index 53f91474f..6634445a6 100644 --- a/stdlib/source/lux/control/monoid.lux +++ b/stdlib/source/lux/control/monoid.lux @@ -1,6 +1,5 @@ (;module: lux) -## Signatures (sig: #export (Monoid a) {#;doc "A way to compose values. @@ -9,3 +8,12 @@ identity) (: (-> a a a) compose)) + +(def: #export (compose Monoid<l> Monoid<r>) + (All [l r] (-> (Monoid l) (Monoid r) (Monoid [l r]))) + (struct (def: identity + [(:: Monoid<l> identity) (:: Monoid<r> identity)]) + + (def: (compose [lL rL] [lR rR]) + [(:: Monoid<l> compose lL lR) + (:: Monoid<r> compose rL rR)]))) diff --git a/stdlib/source/lux/data/bool.lux b/stdlib/source/lux/data/bool.lux index b07d3c8df..c5b345ce1 100644 --- a/stdlib/source/lux/data/bool.lux +++ b/stdlib/source/lux/data/bool.lux @@ -1,6 +1,6 @@ (;module: lux - (lux (control monoid + (lux (control [monoid #+ Monoid] [eq #+ Eq] hash codec))) diff --git a/stdlib/source/lux/data/coll/list.lux b/stdlib/source/lux/data/coll/list.lux index 5db72e77e..cab5479be 100644 --- a/stdlib/source/lux/data/coll/list.lux +++ b/stdlib/source/lux/data/coll/list.lux @@ -1,6 +1,6 @@ (;module: lux - (lux (control monoid + (lux (control [monoid #+ Monoid] ["F" functor] ["A" applicative] ["M" monad #+ do Monad] diff --git a/stdlib/source/lux/data/number.lux b/stdlib/source/lux/data/number.lux index 769561b83..332ce6562 100644 --- a/stdlib/source/lux/data/number.lux +++ b/stdlib/source/lux/data/number.lux @@ -1,7 +1,7 @@ (;module: {#;doc "Implementations of common structures for Lux's primitive number types."} lux (lux (control number - monoid + [monoid #+ Monoid] [eq #+ Eq] hash [order] diff --git a/stdlib/source/lux/data/text.lux b/stdlib/source/lux/data/text.lux index dd25a1359..835d55fd1 100644 --- a/stdlib/source/lux/data/text.lux +++ b/stdlib/source/lux/data/text.lux @@ -1,6 +1,6 @@ (;module: lux - (lux (control monoid + (lux (control [monoid #+ Monoid] [eq #+ Eq] [order] ["M" monad #+ do Monad] |