Last active
August 29, 2015 14:09
-
-
Save buzzdecafe/98e2c23458d6aad9bc77 to your computer and use it in GitHub Desktop.
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
// run in ramda dir | |
var R = require('./ramda'); | |
var Maybe = require('./ext/types/Maybe'); | |
var ms = [Maybe(1), Maybe(2), Maybe(3)]; | |
R.commute(Maybe.of, ms); //=> Maybe([1, 2, 3]) i.e., Just [1, 2, 3] | |
// or just use constructor fn: | |
R.commute(Maybe, ms); //=> Maybe([1, 2, 3]) | |
ms2 = [Maybe(1), Maybe(null), Maybe(3)]; | |
R.commute(Maybe.of, ms2); // Maybe(null) i.e. Nothing | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment