-
-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename
eitherToMaybe
to rightToMaybe
and add leftToMaybe
- Loading branch information
Showing
4 changed files
with
65 additions
and
25 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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
'use strict'; | ||
|
||
const S = require ('..'); | ||
|
||
const eq = require ('./internal/eq'); | ||
|
||
|
||
test ('leftToMaybe', () => { | ||
|
||
eq (S.show (S.leftToMaybe)) ('leftToMaybe :: Either a b -> Maybe a'); | ||
|
||
eq (S.leftToMaybe (S.Left ('Cannot divide by zero'))) (S.Just ('Cannot divide by zero')); | ||
eq (S.leftToMaybe (S.Right (42))) (S.Nothing); | ||
|
||
}); |
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
'use strict'; | ||
|
||
const S = require ('..'); | ||
|
||
const eq = require ('./internal/eq'); | ||
|
||
|
||
test ('rightToMaybe', () => { | ||
|
||
eq (S.show (S.rightToMaybe)) ('rightToMaybe :: Either a b -> Maybe b'); | ||
|
||
eq (S.rightToMaybe (S.Left ('Cannot divide by zero'))) (S.Nothing); | ||
eq (S.rightToMaybe (S.Right (42))) (S.Just (42)); | ||
|
||
}); |