-
-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #102 from fluture-js/avaq/sanctuary-type-identifie…
…rs-2 Improve error messages related to incompatible Futures
- Loading branch information
Showing
24 changed files
with
230 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
import {isFuture} from '../core'; | ||
import {partial1} from '../internal/fn'; | ||
import {invalidArgument} from '../internal/throw'; | ||
import {invalidFuture} from '../internal/throw'; | ||
|
||
function and$left(left, right){ | ||
if(!isFuture(right)) invalidArgument('Future.and', 1, 'be a Future', right); | ||
if(!isFuture(right)) invalidFuture('Future.and', 1, right); | ||
return left.and(right); | ||
} | ||
|
||
export function and(left, right){ | ||
if(!isFuture(left)) invalidArgument('Future.and', 0, 'be a Future', left); | ||
if(!isFuture(left)) invalidFuture('Future.and', 0, left); | ||
if(arguments.length === 1) return partial1(and$left, left); | ||
return and$left(left, right); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
import {isFuture} from '../core'; | ||
import {partial1} from '../internal/fn'; | ||
import {invalidArgument} from '../internal/throw'; | ||
import {invalidFuture} from '../internal/throw'; | ||
|
||
function both$left(left, right){ | ||
if(!isFuture(right)) invalidArgument('Future.both', 1, 'be a Future', right); | ||
if(!isFuture(right)) invalidFuture('Future.both', 1, right); | ||
return left.both(right); | ||
} | ||
|
||
export function both(left, right){ | ||
if(!isFuture(left)) invalidArgument('Future.both', 0, 'be a Future', left); | ||
if(!isFuture(left)) invalidFuture('Future.both', 0, left); | ||
if(arguments.length === 1) return partial1(both$left, left); | ||
return both$left(left, right); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import {isFuture} from '../core'; | ||
import {invalidArgument} from '../internal/throw'; | ||
import {invalidFuture} from '../internal/throw'; | ||
|
||
export function extractLeft(m){ | ||
if(!isFuture(m)) invalidArgument('Future.extractLeft', 0, 'be a Future', m); | ||
if(!isFuture(m)) invalidFuture('Future.extractLeft', 0, m); | ||
return m.extractLeft(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import {isFuture} from '../core'; | ||
import {invalidArgument} from '../internal/throw'; | ||
import {invalidFuture} from '../internal/throw'; | ||
|
||
export function extractRight(m){ | ||
if(!isFuture(m)) invalidArgument('Future.extractRight', 0, 'be a Future', m); | ||
if(!isFuture(m)) invalidFuture('Future.extractRight', 0, m); | ||
return m.extractRight(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
import {isFuture} from '../core'; | ||
import {partial1} from '../internal/fn'; | ||
import {invalidArgument} from '../internal/throw'; | ||
import {invalidFuture} from '../internal/throw'; | ||
|
||
function lastly$right(right, left){ | ||
if(!isFuture(left)) invalidArgument('Future.finally', 1, 'be a Future', left); | ||
if(!isFuture(left)) invalidFuture('Future.finally', 1, left); | ||
return left.finally(right); | ||
} | ||
|
||
export function lastly(right, left){ | ||
if(!isFuture(right)) invalidArgument('Future.finally', 0, 'be a Future', right); | ||
if(!isFuture(right)) invalidFuture('Future.finally', 0, right); | ||
if(arguments.length === 1) return partial1(lastly$right, right); | ||
return lastly$right(right, left); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
import {isFuture} from '../core'; | ||
import {partial1} from '../internal/fn'; | ||
import {invalidArgument} from '../internal/throw'; | ||
import {invalidFuture} from '../internal/throw'; | ||
|
||
function or$left(left, right){ | ||
if(!isFuture(right)) invalidArgument('Future.or', 1, 'be a Future', right); | ||
if(!isFuture(right)) invalidFuture('Future.or', 1, right); | ||
return left.or(right); | ||
} | ||
|
||
export function or(left, right){ | ||
if(!isFuture(left)) invalidArgument('Future.or', 0, 'be a Future', left); | ||
if(!isFuture(left)) invalidFuture('Future.or', 0, left); | ||
if(arguments.length === 1) return partial1(or$left, left); | ||
return or$left(left, right); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import {isFuture} from '../core'; | ||
import {invalidArgument} from '../internal/throw'; | ||
import {invalidFuture} from '../internal/throw'; | ||
|
||
export function promise(m){ | ||
if(!isFuture(m)) invalidArgument('Future.promise', 0, 'be a Future', m); | ||
if(!isFuture(m)) invalidFuture('Future.promise', 0, m); | ||
return m.promise(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
import {isFuture} from '../core'; | ||
import {partial1} from '../internal/fn'; | ||
import {invalidArgument} from '../internal/throw'; | ||
import {invalidFuture} from '../internal/throw'; | ||
|
||
function race$right(right, left){ | ||
if(!isFuture(left)) invalidArgument('Future.race', 1, 'be a Future', left); | ||
if(!isFuture(left)) invalidFuture('Future.race', 1, left); | ||
return left.race(right); | ||
} | ||
|
||
export function race(right, left){ | ||
if(!isFuture(right)) invalidArgument('Future.race', 0, 'be a Future', right); | ||
if(!isFuture(right)) invalidFuture('Future.race', 0, right); | ||
if(arguments.length === 1) return partial1(race$right, right); | ||
return race$right(right, left); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import {isFuture} from '../core'; | ||
import {invalidArgument} from '../internal/throw'; | ||
import {invalidFuture} from '../internal/throw'; | ||
|
||
export function swap(m){ | ||
if(!isFuture(m)) invalidArgument('Future.swap', 0, 'be a Future', m); | ||
if(!isFuture(m)) invalidFuture('Future.swap', 0, m); | ||
return m.swap(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.