fantasyland / fantasy-frees Goto Github PK
View Code? Open in Web Editor NEWFree monad
Free monad
Hello, i try to run tweet-interpreter and get this error
node node_modules/fantasia/examples/interpreter-tweet.js
-----------------------------------
Getting tweets for user 1
/home/mkulesza/projects/query/node_modules/fantasia/src/free.js:59
return f(x).chain(function(y) {
^
TypeError: Object Free.Chain(Free.Return([object Object]), function (tweets) {
// FIXME : This should pass back array of tweets, not a mapped version of tweets [x, y, z] rather than [x][y][z]!
console.log('>', tweets);
var x = tweets.map(function(tweet) {
console.log('>>', tweet);
return getUser(tweet.id).chain(function(user) {
console.log('>>>', user);
return singleton(tweet.str, user);
});
});
console.log(x);
return x;
}),Free.Chain(Free.Return([object Object]), function (tweets) {
// FIXME : This should pass back array of tweets, not a mapped version of tweets [x, y, z] rather than [x][y][z]!
console.log('>', tweets);
var x = tweets.map(function(tweet) {
console.log('>>', tweet);
return getUser(tweet.id).chain(function(user) {
console.log('>>>', user);
return singleton(tweet.str, user);
});
});
console.log(x);
return x;
}),Free.Chain(Free.Return([object Object]), function (tweets) {
// FIXME : This should pass back array of tweets, not a mapped version of tweets [x, y, z] rather than [x][y][z]!
console.log('>', tweets);
var x = tweets.map(function(tweet) {
console.log('>>', tweet);
return getUser(tweet.id).chain(function(user) {
console.log('>>>', user);
return singleton(tweet.str, user);
});
});
console.log(x);
return x;
}) has no method 'chain'
at definitions.resume.cata.Left (/home/mkulesza/projects/query/node_modules/fantasia/src/free.js:59:25)
at definitions.cata (/home/mkulesza/projects/query/node_modules/daggy/daggy.js:134:40)
at definitions.Free.foldMap (/home/mkulesza/projects/query/node_modules/fantasia/src/free.js:57:26)
at Function.Free.runFC (/home/mkulesza/projects/query/node_modules/fantasia/src/free.js:31:14)
at /home/mkulesza/projects/query/node_modules/fantasia/examples/interpreter-tweet.js:130:22
at Object.<anonymous> (/home/mkulesza/projects/query/node_modules/fantasia/examples/interpreter-tweet.js:132:3)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
and terminal missing some dependency
node node_modules/fantasia/examples/interpreter-terminal.js
module.js:340
throw err;
^
Error: Cannot find module 'readline-sync'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/home/mkulesza/projects/query/node_modules/fantasia/examples/interpreter-terminal.js:5:19)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
It will be really nice if you could add some resources so others (including me) could really understand those data structures.
In one project I'm actually using Free from DrBoolean/freeky and understend the ideas of Free and why is it usefull but it is kinda too recursive for me, and I Feel like I did not quite understand it. then I found this repo and i'm kinda lost...
so it will be really nice if you add some resources ❤️
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.