(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
const horeducer = (callback,...reducers) => (state, action) => { | |
var fnamed ={} | |
reducers.map( r => fnamed[r.name]=s=> r(s,action) ) | |
return callback(state,action,fnamed) | |
} | |
const red1 = (state=0,action) =>{ | |
console.log("r1state"); |
//implementation | |
//compose, curry, partial | |
var compose = curry(function(f, g, x) { | |
return f(g(x)) | |
}) |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
import React, { Component } from 'react'; | |
// schema = {name: 'Name', position: 'Position', office: 'Office', age: 'Age', startDate: 'Start date', salary: 'Salary'} | |
// data = [{ name: 'Tiger Nixon', position: 'System Architect', office: 'Edinburgh', age: 61, startDate: '2011/04/25', salary: '$320,800'}, ...] | |
export const DataTableHeader = ({ name }) => ( | |
<div className="card-header"> | |
<i className="fa fa-table"></i>{name} | |
</div> | |
); |
create-react-native-app purescript-app; cd purescript-app
pulp init --force
pulp build
src/Main.js
var React = require("react");
var RN = require("react-native");
exports.text = function(props){
const I = x => x; | |
const K = x => y => x; | |
const A = f => x => f(x); | |
const T = x => f => f(x); | |
const W = f => x => f(x)(x); | |
const C = f => y => x => f(x)(y); | |
const B = f => g => x => f(g(x)); | |
const S = f => g => x => f(x)(g(x)); | |
const P = f => g => x => y => f(g(x))(g(y)); | |
const Y = f => (g => g(g))(g => f(x => g(g)(x))); |
interface IO<T> { | |
(unsafeIO: Function): IO<T>; | |
chain(fn: (a: T) => IO<T>): IO<T> | |
of(performUnsafeIO: (a: T) => T): IO<T>; | |
fork(): IO<T>; | |
map(fn: (a: T) => T): IO<T>; | |
value: Function | |
}; | |
type KIO<T> = (a: T) => T; |
const trampoline = fn => (...args) => { | |
let result = fn(...args) | |
while (typeof result === 'function') { | |
result = result() | |
} | |
return result | |
} |
function Complex(re, im) { | |
this.re = re; | |
this.im = im; | |
return this; | |
} | |
Complex.of = function (r, i) { | |
return new Complex(r,i); | |
} |
type lazy_node_t('a) = | |
| Delayed(unit => 'a) | |
| Value('a) | |
| Exn(exn); | |
type lazy_t('a) = ref(lazy_node_t('a)); | |
let lazy_from_fun = f => ref(Delayed(f)); | |
let force = x_lazy => | |
switch (x_lazy^) { | |
| Value(x) => x |