THIS GIST WAS MOVED TO TERMSTANDARD/COLORS
REPOSITORY.
PLEASE ASK YOUR QUESTIONS OR ADD ANY SUGGESTIONS AS A REPOSITORY ISSUES OR PULL REQUESTS INSTEAD!
THIS GIST WAS MOVED TO TERMSTANDARD/COLORS
REPOSITORY.
PLEASE ASK YOUR QUESTIONS OR ADD ANY SUGGESTIONS AS A REPOSITORY ISSUES OR PULL REQUESTS INSTEAD!
A future should provide the fork
, of
, chain
, and orElse
methods, subject to the following rules:
computation
should fulfil the type (α → γ), (β → γ) → γ
.[[Computation]]
, as-is.computation
is not a function, the behaviour is undefined.var later = Function.bind.bind(window.setTimeout, window); | |
// Usage | |
element.addEventListener('click', later(foo, 1000)); | |
// On click, `foo` will be executed after 1 second with the usual event parameters passed along |
First and foremost, let's take a look at the following pieces of code. The first one is something you should be rather familiar with, and the second one is also a somewhat familiar idiom these days (at least in languages with higher-order functions):
// Example 1:
30 + 12
// Example 2:
xs.map(f)
import Graphics.Input as Input | |
import String | |
main = lift2 scene textBox name | |
(textBox, name) = Input.field "What is your name?" | |
scene textBox name = [markdown| | |
{{ textBox }} |
var parent = getParentElement() | |
viewModel.slots(function (data) { | |
var diff = data.diff | |
var index = diff[0] | |
var newItem = diff[2] | |
var deleteAmount = diff[1] | |
if (newItem) { | |
var elem = renderNewElement(newItem) |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
/* Examples: | |
Use grep with two arguments to find inherited or direct properties of an object: | |
> grep(document, 'get') // see all properties case insensitively matching *get*: | |
{ getCSSCanvasContext: function getCSSCanvasContext() { [native code] } | |
, getElementById: function getElementById() { [native code] } | |
, getElementsByClassName: function getElementsByClassName() { [native code] } | |
, getElementsByName: function getElementsByName() { [native code] } | |
, getElementsByTagName: function getElementsByTagName() { [native code] } |
FRP to me means building your app by transforming values over time, from the input to the current state to the display.
This implementation is based on a the [graphics][1] library and is heavily inspired by [Elm][2]
A full implementation of TodoFRP can be found [online at Raynos/graphics example server][3]
The question: how can we use ES6 modules in Node.js, where modules-as-functions is very common? That is, given a future in which V8 supports ES6 modules:
export
syntax, without breaking consumers that do require("function-module")()
?import
syntax, while not demanding that the module author rewrites his code to ES6 export
?@wycats showed me a solution. It involves hooking into the loader API to do some rewriting, and using a distinguished name for the single export.
This is me eating crow for lots of false statements I've made all over Twitter today. Here it goes.