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
// Forked and modified from https://gist.github.com/DrBoolean/34c1d3651d1338b1b187 | |
const daggy = require('daggy') | |
const compose = (f, g) => x => f(g(x)) | |
const id = x => x | |
const kleisli_compose = (f, g) => x => f(x).flatMap(g) | |
//=============FREE============= | |
const Free = daggy.taggedSum({Suspend: ['x', 'f'], Pure: ['x']}) |
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
// Utility function for detecting generators. | |
let isGenerator = x => { | |
return Function.isGenerator && | |
Function.isGenerator.call(x) | |
} | |
// Data type represents channel into which values | |
// can be `put`, or `received` from. Channel is | |
// very much like queue where reads and writes are | |
// synchronized via continuation passing. |