|
183 | 183 |
|
184 | 184 | /* istanbul ignore else */
|
185 | 185 | if (typeof module === 'object' && typeof module.exports === 'object') {
|
186 |
| - module.exports = f (require ('sanctuary-show'), |
| 186 | + module.exports = f (require ('sanctuary-either'), |
| 187 | + require ('sanctuary-show'), |
187 | 188 | require ('sanctuary-type-classes'),
|
188 | 189 | require ('sanctuary-type-identifiers'));
|
189 | 190 | } else if (typeof define === 'function' && define.amd != null) {
|
190 |
| - define (['sanctuary-show', |
| 191 | + define (['sanctuary-either', |
| 192 | + 'sanctuary-show', |
191 | 193 | 'sanctuary-type-classes',
|
192 | 194 | 'sanctuary-type-identifiers'],
|
193 | 195 | f);
|
194 | 196 | } else {
|
195 |
| - self.sanctuaryDef = f (self.sanctuaryShow, |
| 197 | + self.sanctuaryDef = f (self.sanctuaryEither, |
| 198 | + self.sanctuaryShow, |
196 | 199 | self.sanctuaryTypeClasses,
|
197 | 200 | self.sanctuaryTypeIdentifiers);
|
198 | 201 | }
|
199 | 202 |
|
200 |
| -} (function(show, Z, type) { |
| 203 | +} (function(Either, show, Z, type) { |
201 | 204 |
|
202 | 205 | 'use strict';
|
203 | 206 |
|
|
207 | 210 | var slice = Array.prototype.slice;
|
208 | 211 | var hasOwnProperty = Object.prototype.hasOwnProperty;
|
209 | 212 |
|
210 |
| - function Either(tag, value) { |
211 |
| - this.isLeft = tag === 'Left'; |
212 |
| - this.isRight = tag === 'Right'; |
213 |
| - this.value = value; |
214 |
| - } |
215 |
| - |
216 |
| - Either['@@type'] = 'sanctuary-def/Either'; |
217 |
| - |
218 |
| - Either.prototype['fantasy-land/map'] = function(f) { |
219 |
| - return this.isLeft ? this : Right (f (this.value)); |
220 |
| - }; |
221 |
| - |
222 |
| - Either.prototype['fantasy-land/chain'] = function(f) { |
223 |
| - return this.isLeft ? this : f (this.value); |
224 |
| - }; |
225 |
| - |
226 | 213 | // Left :: a -> Either a b
|
227 |
| - function Left(x) { return new Either ('Left', x); } |
| 214 | + var Left = Either.Left; |
228 | 215 |
|
229 | 216 | // Right :: b -> Either a b
|
230 |
| - function Right(x) { return new Either ('Right', x); } |
| 217 | + var Right = Either.Right; |
231 | 218 |
|
232 | 219 | // K :: a -> b -> a
|
233 | 220 | function K(x) { return function(y) { return x; }; }
|
|
0 commit comments