- Free monads
- Dependecy injection via Reader monad
- Monad Transformers - ContT
- Monad Transformers - ConsoleT
- Extensible Effects
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
| (function (global) { | |
| function require(file, parentModule) { | |
| if ({}.hasOwnProperty.call(require.cache, file)) | |
| return require.cache[file]; | |
| var resolved = require.resolve(file); | |
| if (!resolved) | |
| throw new Error('Failed to resolve module ' + file); | |
| var module$ = { | |
| id: file, | |
| require: require, |
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
| function apply(f) { | |
| return function(x) { | |
| return f(x); | |
| }; | |
| } | |
| apply(console.log)(2); | |
| // Using fat arrow. | |
| function apply(f) { |
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
| macro $chain { | |
| case {_ (<-, $x , $do { $block ... } ; $rest ...)} => { | |
| return #{ | |
| var $x = function() { | |
| return $do { $block ... } | |
| }(); | |
| return function() { | |
| return $do { $rest ... } | |
| } | |
| }; |
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
| var M = State.StateT(IO), | |
| program = M.lift(init) | |
| .chain(doSomething) | |
| .chain(doSomethingElse) | |
| .chain(doSomethingWicked); | |
| console.log(program.exec([]).unsafePerform()); | |
| /* |
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
| wc -l $(git ls-files | grep '.*\.js') |
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
| package main | |
| import "fmt" | |
| type Envelope struct { | |
| message string | |
| sender Actor | |
| } | |
| type Actor interface { |
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
| // You can edit this code! | |
| // Click here and start typing. | |
| package main | |
| import "fmt" | |
| type AnyVal interface{} | |
| type IProduct interface { | |
| ProductArity() int |
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
| #expr { | |
| width: 100%; | |
| height: 300px; | |
| } | |
| body, textarea, button { | |
| font-size: 12pt; | |
| font-family: monospace; | |
| } | |
| .hover { |
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
| require ('./globals')(global); // Mixed in Ramda to global here | |
| var Task = require ('data.future'), | |
| M = require ('control.monads'), | |
| State = require ('fantasy-states'), | |
| Reader = require ('fantasy-readers'), | |
| Tuple2 = require ('fantasy-tuples').Tuple2, | |
| Maybe = require ('data.maybe'), | |
| ST = State.StateT (Task), | |
| App = Reader.ReaderT (ST); |