exalted.future
Advanced tools
Comparing version 0.0.5 to 0.0.6
{ | ||
"name": "exalted.future", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "Exalted monadic library & functional fun, fantasy-land compliant, mostly.", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/pre63/exalted.future.git", |
@@ -112,6 +112,6 @@ # exalted.future | ||
### fold | ||
### cata | ||
[Foldable][6] | ||
``` | ||
fold :: (a -> b) -> b | ||
cata :: ({ Left: () -> b, Right -> a -> a }) -> a | b | ||
``` | ||
@@ -158,3 +158,3 @@ ```javascript | ||
.map(num => num - 1) | ||
.fold({ | ||
.cata({ | ||
Right: a => a | ||
@@ -173,3 +173,3 @@ }) | ||
.map(sentence => `${sentence}!`) | ||
.fold({ | ||
.cata({ | ||
Right: console.log | ||
@@ -183,3 +183,3 @@ }) | ||
.alt(() => 'Maybe received a null') | ||
.fold({ | ||
.cata({ | ||
Right: console.log | ||
@@ -191,3 +191,3 @@ }) | ||
### alt | ||
Sets the value to fold on. | ||
Sets the value to cata on. | ||
``` | ||
@@ -197,3 +197,3 @@ alt :: Any -> Nothing of Any | ||
```javascript | ||
Maybe(1).alt(5).fold({ | ||
Maybe(1).alt(5).cata({ | ||
Right: a => a | ||
@@ -203,3 +203,3 @@ }) | ||
Maybe(null).alt(5).fold({ | ||
Maybe(null).alt(5).cata({ | ||
Right: a => a | ||
@@ -210,9 +210,9 @@ }) | ||
### fold | ||
### cata | ||
[Foldable][6] | ||
``` | ||
fold :: (a -> b) -> b | ||
cata :: ({ Left: () -> b, Right: a -> b }) -> a|b | ||
``` | ||
```javascript | ||
Maybe(5).fold({ | ||
Maybe(5).cata({ | ||
Right: a => a | ||
@@ -222,3 +222,3 @@ }) | ||
Maybe(5).fold({ | ||
Maybe(5).cata({ | ||
Left: () => { } // not called | ||
@@ -229,3 +229,3 @@ Right: a => a + 1 | ||
Maybe(null).fold({ | ||
Maybe(null).cata({ | ||
Left: () => 'there was a null' | ||
@@ -242,3 +242,3 @@ Right: a => a + 1 // not called | ||
nullable('Hello') // this will return a Right('Hello') | ||
.fold({ | ||
.cata({ | ||
Left: () => 'Oops', | ||
@@ -250,3 +250,3 @@ Right: val => `${val} world!` | ||
nullable(null) // this will return a Left() | ||
.fold({ | ||
.cata({ | ||
Left: () => 'Oops', | ||
@@ -260,3 +260,3 @@ Right: val => `${val} world!` | ||
.map(extractDomain) | ||
.fold({ | ||
.cata({ | ||
Left: () => 'No email found!', | ||
@@ -269,3 +269,3 @@ Right:x => x | ||
.map(extractDomain) // this will not get executed | ||
.fold({ | ||
.cata({ | ||
Left: () => 'No email found!', | ||
@@ -277,9 +277,9 @@ Right: x => x | ||
### fold | ||
### cata | ||
[Foldable][6] - Folds foldable object. | ||
``` | ||
fold :: ({ Left: () -> b, Right -> a -> a }) -> a | b | ||
cata :: ({ Left: () -> b, Right -> a -> a }) -> a | b | ||
``` | ||
```javascript | ||
Right(5).fold({ | ||
Right(5).cata({ | ||
Left: () => 1, | ||
@@ -290,3 +290,3 @@ Right: a => a + 2 | ||
Left(5).fold(a => a + 1) | ||
Left(5).cata(a => a + 1) | ||
//=> 6 | ||
@@ -343,2 +343,3 @@ ``` | ||
[Foldable][6] | ||
Folds on identity. | ||
``` | ||
@@ -345,0 +346,0 @@ fold :: (a -> b) -> b |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
32723
421