-
-
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 #277 from fluture-js/avaq/simple-dispatch
Drop support for "primitive" dispatching
- Loading branch information
Showing
11 changed files
with
65 additions
and
44 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,15 @@ | ||
import Z from 'sanctuary-type-classes'; | ||
import {isAlt} from '../internal/predicates'; | ||
import {FL} from '../internal/const'; | ||
import {partial1} from '../internal/utils'; | ||
import {throwInvalidArgument} from '../internal/throw'; | ||
|
||
function alt$left(left, right){ | ||
if(!Z.Alt.test(right)) throwInvalidArgument('alt', 1, 'be an Alt', right); | ||
return Z.alt(left, right); | ||
if(!isAlt(right)) throwInvalidArgument('alt', 1, 'be an Alt', right); | ||
return left[FL.alt](right); | ||
} | ||
|
||
export function alt(left, right){ | ||
if(!Z.Alt.test(left)) throwInvalidArgument('alt', 0, 'be an Alt', left); | ||
if(!isAlt(left)) throwInvalidArgument('alt', 0, 'be an Alt', left); | ||
if(arguments.length === 1) return partial1(alt$left, left); | ||
return alt$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,15 @@ | ||
import Z from 'sanctuary-type-classes'; | ||
import {isApply} from '../internal/predicates'; | ||
import {FL} from '../internal/const'; | ||
import {partial1} from '../internal/utils'; | ||
import {throwInvalidArgument} from '../internal/throw'; | ||
|
||
function ap$mval(mval, mfunc){ | ||
if(!Z.Apply.test(mfunc)) throwInvalidArgument('Future.ap', 1, 'be an Apply', mfunc); | ||
return Z.ap(mval, mfunc); | ||
if(!isApply(mfunc)) throwInvalidArgument('Future.ap', 1, 'be an Apply', mfunc); | ||
return mfunc[FL.ap](mval); | ||
} | ||
|
||
export function ap(mval, mfunc){ | ||
if(!Z.Apply.test(mval)) throwInvalidArgument('Future.ap', 0, 'be an Apply', mval); | ||
if(!isApply(mval)) throwInvalidArgument('Future.ap', 0, 'be an Apply', mval); | ||
if(arguments.length === 1) return partial1(ap$mval, mval); | ||
return ap$mval(mval, mfunc); | ||
} |
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