Last active
December 18, 2015 04:09
-
-
Save apaleslimghost/5723401 to your computer and use it in GitHub Desktop.
visionmedia/co + curried functions
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
const co = require('co'), | |
fs = require('fs'), | |
curry = require('prelude-ls').curry; | |
var read = curry(fs.readFile()); | |
co(function* () { | |
var a = yield read('.gitignore','utf8'); | |
var b = yield read('Makefile','utf8'); | |
var c = yield read('package.json','utf8'); | |
console.log(a,b,c); | |
}); |
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
require! {co, fs, 'prelude-ls'.curry} | |
read = curry fs.read-file | |
co -*> | |
a = yield read '.gitignore' \utf8 | |
b = yield read 'Makefile' \utf8 | |
c = yield read 'package.json' \utf8 | |
console.log a,b,c |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
nb that's a hypothetical future LiveScript with support for generators and yield