Skip to content

Commit 01fcb40

Browse files
committed
Version 2.0.0
1 parent 63492eb commit 01fcb40

File tree

2 files changed

+32
-42
lines changed

2 files changed

+32
-42
lines changed

README.md

Lines changed: 31 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,14 @@ value is of type `b`.
1111
```javascript
1212
> const Useless = require ('sanctuary-useless')
1313

14+
> const isTypeClass = x =>
15+
. type (x) === 'sanctuary-type-classes/TypeClass@1'
16+
1417
> S.map (k => k + ' '.repeat (16 - k.length) +
1518
. (Z[k].test (Right (Useless)) ? '\u2705 ' :
1619
. Z[k].test (Right (['foo'])) ? '\u2705 * ' :
1720
. /* otherwise */ '\u274C '))
18-
. (S.keys (S.unchecked.filter (S.is ($.TypeClass)) (Z)))
21+
. (S.keys (S.unchecked.filter (isTypeClass) (Z)))
1922
[ 'Setoid ✅ * ', // if ‘a’ and ‘b’ satisfy Setoid
2023
. 'Ord ✅ * ', // if ‘a’ and ‘b’ satisfy Ord
2124
. 'Semigroupoid ❌ ',
@@ -42,11 +45,11 @@ value is of type `b`.
4245
. 'Contravariant ❌ ' ]
4346
```
4447

45-
#### <a name="Either" href="https://github.com/sanctuary-js/sanctuary-either/blob/v1.2.0/index.js#L144">`Either :: TypeRep Either`</a>
48+
#### <a name="Either" href="https://github.com/sanctuary-js/sanctuary-either/blob/v2.0.0/index.js#L144">`Either :: TypeRep Either`</a>
4649

4750
Either [type representative][].
4851

49-
#### <a name="Either.Left" href="https://github.com/sanctuary-js/sanctuary-either/blob/v1.2.0/index.js#L148">`Either.Left :: a -⁠> Either a b`</a>
52+
#### <a name="Either.Left" href="https://github.com/sanctuary-js/sanctuary-either/blob/v2.0.0/index.js#L148">`Either.Left :: a -⁠> Either a b`</a>
5053

5154
Constructs a value of type `Either a b` from a value of type `a`.
5255

@@ -55,7 +58,7 @@ Constructs a value of type `Either a b` from a value of type `a`.
5558
Left ('sqrt undefined for -1')
5659
```
5760

58-
#### <a name="Either.Right" href="https://github.com/sanctuary-js/sanctuary-either/blob/v1.2.0/index.js#L171">`Either.Right :: b -⁠> Either a b`</a>
61+
#### <a name="Either.Right" href="https://github.com/sanctuary-js/sanctuary-either/blob/v2.0.0/index.js#L171">`Either.Right :: b -⁠> Either a b`</a>
5962

6063
Constructs a value of type `Either a b` from a value of type `b`.
6164

@@ -64,19 +67,7 @@ Constructs a value of type `Either a b` from a value of type `b`.
6467
Right (42)
6568
```
6669

67-
#### <a name="Either.@@type" href="https://github.com/sanctuary-js/sanctuary-either/blob/v1.2.0/index.js#L194">`Either.@@type :: String`</a>
68-
69-
Either [type identifier][].
70-
71-
```javascript
72-
> type (Right (42))
73-
'sanctuary-either/Either@1'
74-
75-
> type.parse (type (Right (42)))
76-
{namespace: 'sanctuary-either', name: 'Either', version: 1}
77-
```
78-
79-
#### <a name="Either.fantasy-land/of" href="https://github.com/sanctuary-js/sanctuary-either/blob/v1.2.0/index.js#L207">`Either.fantasy-land/of :: b -⁠> Either a b`</a>
70+
#### <a name="Either.fantasy-land/of" href="https://github.com/sanctuary-js/sanctuary-either/blob/v2.0.0/index.js#L194">`Either.fantasy-land/of :: b -⁠> Either a b`</a>
8071

8172
- `of (Either) (x)` is equivalent to `Right (x)`
8273

@@ -85,7 +76,7 @@ Either [type identifier][].
8576
Right (42)
8677
```
8778

88-
#### <a name="Either.fantasy-land/chainRec" href="https://github.com/sanctuary-js/sanctuary-either/blob/v1.2.0/index.js#L220">`Either.fantasy-land/chainRec :: ((a -⁠> c, b -⁠> c, a) -⁠> Either d c, a) -⁠> Either d b`</a>
79+
#### <a name="Either.fantasy-land/chainRec" href="https://github.com/sanctuary-js/sanctuary-either/blob/v2.0.0/index.js#L207">`Either.fantasy-land/chainRec :: ((a -⁠> c, b -⁠> c, a) -⁠> Either d c, a) -⁠> Either d b`</a>
8980

9081
```javascript
9182
> Z.chainRec (
@@ -105,7 +96,7 @@ Left ('!!')
10596
Right (65536)
10697
```
10798

108-
#### <a name="Either.prototype.@@show" href="https://github.com/sanctuary-js/sanctuary-either/blob/v1.2.0/index.js#L249">`Either#@@show :: (Showable a, Showable b) => Either a b ~> () -⁠> String`</a>
99+
#### <a name="Either.prototype.@@show" href="https://github.com/sanctuary-js/sanctuary-either/blob/v2.0.0/index.js#L236">`Either#@@show :: (Showable a, Showable b) => Either a b ~> () -⁠> String`</a>
109100

110101
- `show (Left (x))` is equivalent to `'Left (' + show (x) + ')'`
111102
- `show (Right (x))` is equivalent to `'Right (' + show (x) + ')'`
@@ -118,7 +109,7 @@ Right (65536)
118109
'Right ([1, 2, 3])'
119110
```
120111

121-
#### <a name="Either.prototype.fantasy-land/equals" href="https://github.com/sanctuary-js/sanctuary-either/blob/v1.2.0/index.js#L268">`Either#fantasy-land/equals :: (Setoid a, Setoid b) => Either a b ~> Either a b -⁠> Boolean`</a>
112+
#### <a name="Either.prototype.fantasy-land/equals" href="https://github.com/sanctuary-js/sanctuary-either/blob/v2.0.0/index.js#L255">`Either#fantasy-land/equals :: (Setoid a, Setoid b) => Either a b ~> Either a b -⁠> Boolean`</a>
122113

123114
- `Left (x)` is equal to `Left (y)` [iff][] `x` is equal to `y`
124115
according to [`Z.equals`][]
@@ -137,7 +128,7 @@ true
137128
false
138129
```
139130

140-
#### <a name="Either.prototype.fantasy-land/lte" href="https://github.com/sanctuary-js/sanctuary-either/blob/v1.2.0/index.js#L293">`Either#fantasy-land/lte :: (Ord a, Ord b) => Either a b ~> Either a b -⁠> Boolean`</a>
131+
#### <a name="Either.prototype.fantasy-land/lte" href="https://github.com/sanctuary-js/sanctuary-either/blob/v2.0.0/index.js#L280">`Either#fantasy-land/lte :: (Ord a, Ord b) => Either a b ~> Either a b -⁠> Boolean`</a>
141132

142133
- `Left (x)` is less than or equal to `Left (y)` [iff][] `x` is less
143134
than or equal to `y` according to [`Z.lte`][]
@@ -159,7 +150,7 @@ false
159150
[Left (0), Left (1), Left (2)]
160151
```
161152

162-
#### <a name="Either.prototype.fantasy-land/concat" href="https://github.com/sanctuary-js/sanctuary-either/blob/v1.2.0/index.js#L321">`Either#fantasy-land/concat :: (Semigroup a, Semigroup b) => Either a b ~> Either a b -⁠> Either a b`</a>
153+
#### <a name="Either.prototype.fantasy-land/concat" href="https://github.com/sanctuary-js/sanctuary-either/blob/v2.0.0/index.js#L308">`Either#fantasy-land/concat :: (Semigroup a, Semigroup b) => Either a b ~> Either a b -⁠> Either a b`</a>
163154

164155
- `concat (Left (x)) (Left (y))` is equivalent to
165156
`Left (concat (x) (y))`
@@ -182,7 +173,7 @@ Right ([1, 2, 3])
182173
Right ([1, 2, 3])
183174
```
184175

185-
#### <a name="Either.prototype.fantasy-land/map" href="https://github.com/sanctuary-js/sanctuary-either/blob/v1.2.0/index.js#L350">`Either#fantasy-land/map :: Either a b ~> (b -⁠> c) -⁠> Either a c`</a>
176+
#### <a name="Either.prototype.fantasy-land/map" href="https://github.com/sanctuary-js/sanctuary-either/blob/v2.0.0/index.js#L337">`Either#fantasy-land/map :: Either a b ~> (b -⁠> c) -⁠> Either a c`</a>
186177

187178
- `map (f) (Left (x))` is equivalent to `Left (x)`
188179
- `map (f) (Right (x))` is equivalent to `Right (f (x))`
@@ -195,7 +186,7 @@ Left ('sqrt undefined for -1')
195186
Right (100)
196187
```
197188

198-
#### <a name="Either.prototype.fantasy-land/bimap" href="https://github.com/sanctuary-js/sanctuary-either/blob/v1.2.0/index.js#L369">`Either#fantasy-land/bimap :: Either a c ~> (a -⁠> b, c -⁠> d) -⁠> Either b d`</a>
189+
#### <a name="Either.prototype.fantasy-land/bimap" href="https://github.com/sanctuary-js/sanctuary-either/blob/v2.0.0/index.js#L356">`Either#fantasy-land/bimap :: Either a c ~> (a -⁠> b, c -⁠> d) -⁠> Either b d`</a>
199190

200191
- `bimap (f) (g) (Left (x))` is equivalent to `Left (f (x))`
201192
- `bimap (f) (g) (Right (x))` is equivalent to `Right (g (x))`
@@ -208,7 +199,7 @@ Left ('ABC')
208199
Right (100)
209200
```
210201

211-
#### <a name="Either.prototype.fantasy-land/ap" href="https://github.com/sanctuary-js/sanctuary-either/blob/v1.2.0/index.js#L388">`Either#fantasy-land/ap :: Either a b ~> Either a (b -⁠> c) -⁠> Either a c`</a>
202+
#### <a name="Either.prototype.fantasy-land/ap" href="https://github.com/sanctuary-js/sanctuary-either/blob/v2.0.0/index.js#L375">`Either#fantasy-land/ap :: Either a b ~> Either a (b -⁠> c) -⁠> Either a c`</a>
212203

213204
- `ap (Left (x)) (Left (y))` is equivalent to `Left (x)`
214205
- `ap (Left (x)) (Right (y))` is equivalent to `Left (x)`
@@ -229,7 +220,7 @@ Left ('sqrt undefined for -1')
229220
Right (100)
230221
```
231222

232-
#### <a name="Either.prototype.fantasy-land/chain" href="https://github.com/sanctuary-js/sanctuary-either/blob/v1.2.0/index.js#L415">`Either#fantasy-land/chain :: Either a b ~> (b -⁠> Either a c) -⁠> Either a c`</a>
223+
#### <a name="Either.prototype.fantasy-land/chain" href="https://github.com/sanctuary-js/sanctuary-either/blob/v2.0.0/index.js#L402">`Either#fantasy-land/chain :: Either a b ~> (b -⁠> Either a c) -⁠> Either a c`</a>
233224

234225
- `chain (f) (Left (x))` is equivalent to `Left (x)`
235226
- `chain (f) (Right (x))` is equivalent to `f (x)`
@@ -248,28 +239,28 @@ Left ('sqrt undefined for -1')
248239
Right (5)
249240
```
250241

251-
#### <a name="Either.prototype.fantasy-land/alt" href="https://github.com/sanctuary-js/sanctuary-either/blob/v1.2.0/index.js#L440">`Either#fantasy-land/alt :: Either a b ~> Either a b -⁠> Either a b`</a>
242+
#### <a name="Either.prototype.fantasy-land/alt" href="https://github.com/sanctuary-js/sanctuary-either/blob/v2.0.0/index.js#L427">`Either#fantasy-land/alt :: Either a b ~> Either a b -⁠> Either a b`</a>
252243

253-
- `alt (Left (x)) (Left (y))` is equivalent to `Left (y)`
254-
- `alt (Left (x)) (Right (y))` is equivalent to `Right (y)`
255-
- `alt (Right (x)) (Left (y))` is equivalent to `Right (x)`
256-
- `alt (Right (x)) (Right (y))` is equivalent to `Right (x)`
244+
- `alt (Left (y)) (Left (x))` is equivalent to `Left (y)`
245+
- `alt (Right (y)) (Left (x))` is equivalent to `Right (y)`
246+
- `alt (Left (y)) (Right (x))` is equivalent to `Right (x)`
247+
- `alt (Right (y)) (Right (x))` is equivalent to `Right (x)`
257248

258249
```javascript
259-
> S.alt (Left ('A')) (Left ('B'))
250+
> S.alt (Left ('B')) (Left ('A'))
260251
Left ('B')
261252

262-
> S.alt (Left ('C')) (Right (1))
253+
> S.alt (Right (1)) (Left ('C'))
263254
Right (1)
264255

265-
> S.alt (Right (2)) (Left ('D'))
256+
> S.alt (Left ('D')) (Right (2))
266257
Right (2)
267258

268-
> S.alt (Right (3)) (Right (4))
259+
> S.alt (Right (4)) (Right (3))
269260
Right (3)
270261
```
271262

272-
#### <a name="Either.prototype.fantasy-land/reduce" href="https://github.com/sanctuary-js/sanctuary-either/blob/v1.2.0/index.js#L467">`Either#fantasy-land/reduce :: Either a b ~> ((c, b) -⁠> c, c) -⁠> c`</a>
263+
#### <a name="Either.prototype.fantasy-land/reduce" href="https://github.com/sanctuary-js/sanctuary-either/blob/v2.0.0/index.js#L454">`Either#fantasy-land/reduce :: Either a b ~> ((c, b) -⁠> c, c) -⁠> c`</a>
273264

274265
- `reduce (f) (x) (Left (y))` is equivalent to `x`
275266
- `reduce (f) (x) (Right (y))` is equivalent to `f (x) (y)`
@@ -282,7 +273,7 @@ Right (3)
282273
[1, 2]
283274
```
284275

285-
#### <a name="Either.prototype.fantasy-land/traverse" href="https://github.com/sanctuary-js/sanctuary-either/blob/v1.2.0/index.js#L486">`Either#fantasy-land/traverse :: Applicative f => Either a b ~> (TypeRep f, b -⁠> f c) -⁠> f (Either a c)`</a>
276+
#### <a name="Either.prototype.fantasy-land/traverse" href="https://github.com/sanctuary-js/sanctuary-either/blob/v2.0.0/index.js#L473">`Either#fantasy-land/traverse :: Applicative f => Either a b ~> (TypeRep f, b -⁠> f c) -⁠> f (Either a c)`</a>
286277

287278
- `traverse (A) (f) (Left (x))` is equivalent to `of (A) (Left (x))`
288279
- `traverse (A) (f) (Right (x))` is equivalent to `map (Right) (f (x))`
@@ -295,7 +286,7 @@ Right (3)
295286
[Right ('foo'), Right ('bar'), Right ('baz')]
296287
```
297288

298-
#### <a name="Either.prototype.fantasy-land/extend" href="https://github.com/sanctuary-js/sanctuary-either/blob/v1.2.0/index.js#L505">`Either#fantasy-land/extend :: Either a b ~> (Either a b -⁠> c) -⁠> Either a c`</a>
289+
#### <a name="Either.prototype.fantasy-land/extend" href="https://github.com/sanctuary-js/sanctuary-either/blob/v2.0.0/index.js#L492">`Either#fantasy-land/extend :: Either a b ~> (Either a b -⁠> c) -⁠> Either a c`</a>
299290

300291
- `extend (f) (Left (x))` is equivalent to `Left (x)`
301292
- `extend (f) (Right (x))` is equivalent to `Right (f (Right (x)))`
@@ -309,8 +300,7 @@ Right (100)
309300
```
310301

311302
[Fantasy Land]: https://github.com/fantasyland/fantasy-land/tree/v4.0.1
312-
[`Z.equals`]: https://github.com/sanctuary-js/sanctuary-type-classes/tree/v11.0.0#equals
313-
[`Z.lte`]: https://github.com/sanctuary-js/sanctuary-type-classes/tree/v11.0.0#lte
303+
[`Z.equals`]: https://github.com/sanctuary-js/sanctuary-type-classes/tree/v12.0.0#equals
304+
[`Z.lte`]: https://github.com/sanctuary-js/sanctuary-type-classes/tree/v12.0.0#lte
314305
[iff]: https://en.wikipedia.org/wiki/If_and_only_if
315-
[type identifier]: https://github.com/sanctuary-js/sanctuary-type-identifiers/tree/v2.0.1
316306
[type representative]: https://github.com/fantasyland/fantasy-land/tree/v4.0.1#type-representatives

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sanctuary-either",
3-
"version": "1.2.0",
3+
"version": "2.0.0",
44
"description": "Fantasy Land -compliant Either type",
55
"license": "MIT",
66
"repository": {

0 commit comments

Comments
 (0)