** [] https://www.cs.cmu.edu/~rwh/theses/okasaki.pdf
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
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 |
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 Complex(re, im) { | |
this.re = re; | |
this.im = im; | |
return this; | |
} | |
Complex.of = function (r, i) { | |
return new Complex(r,i); | |
} |
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
const trampoline = fn => (...args) => { | |
let result = fn(...args) | |
while (typeof result === 'function') { | |
result = result() | |
} | |
return result | |
} |
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
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; |
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
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))); |
-
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){
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
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> | |
); |
(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.
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
//implementation | |
//compose, curry, partial | |
var compose = curry(function(f, g, x) { | |
return f(g(x)) | |
}) |