Created
January 3, 2017 23:51
-
-
Save jrsinclair/23d8c5d05efce3d1eafaf729f7a195d4 to your computer and use it in GitHub Desktop.
Lightweight pointfree monad operators. Poor-man's https://github.com/DrBoolean/pointfree-fantasy
This file contains hidden or 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
| /** | |
| * Functions for working with monads. | |
| * | |
| * https://github.com/DrBoolean/pointfree-fantasy is probably a better implementation. | |
| */ | |
| /* eslint prefer-arrow-callback: 0 */ | |
| import {curry} from 'lodash/fp'; | |
| export const fmap = curry(function fmap(f, m) { | |
| return m.map(f); | |
| }); | |
| export const chain = curry(function chain(f, m) { | |
| return m.chain(f); | |
| }); | |
| export const join = curry(function join(m) { | |
| return m.join(); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment