-
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 Day = ({ get, left, right }) => { | |
const map = f => Day ({ | |
get: f (extract()), | |
left, right | |
}) | |
const extend = f => | |
Day ({ | |
get: (left, right) => f (Day ({ get, left, right })), |
// in response to https://twitter.com/arntzenius/status/1022076441603829760 | |
// types A,B ∷= base | A → B | |
// terms M ∷= E | λx.M | |
// exprs E ∷= x | E M | (M : A) | |
type Type = "Base" | {lhs: Type, tag: "->", rhs: Type}; | |
type Var = string; | |
type Term = Expr | {tag: "Lam", varname: Var, body: Term}; | |
type Expr = Var | {tag: "App", fn: Expr, arg: Term} | {term: Term, tag: ":", tp: Type}; |
import { | |
end, | |
int, | |
lit, | |
Match, | |
parse, | |
Route as RouteBase, | |
zero | |
} from "fp-ts-routing"; | |
import { pipe } from "fp-ts/lib/function"; |
"use strict"; | |
var React = require("react"); | |
var ReactDOM = require("react-dom"); | |
exports.makeRef = function(toMaybe) { | |
var Ref = function(props) { | |
this.DOMNode = null; | |
return this; | |
}; |
#!/usr/bin/env stack | |
-- stack --resolver lts-10.8 --install-ghc exec ghci | |
{-# LANGUAGE ConstraintKinds #-} | |
{-# LANGUAGE ExistentialQuantification #-} | |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE LambdaCase #-} | |
-- A key type for pretend use in looking up a doggo in a database. | |
newtype Key a = Key { unKey :: String } |
use std::rc::Rc; | |
trait HKT<U> { | |
type C; // Current type | |
type T; // Type with C swapped with U | |
} | |
macro_rules! derive_hkt { | |
($t:ident) => { | |
impl<T, U> HKT<U> for $t<T> { |
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){
Ramda | Sanctuary |
---|---|
add(a, b) |
add(b, a) |
addIndex(f) |
`` |
adjust(f, i, xs) |
`` |
all(f, xs) |
`` |
allPass(fs, x) |
allPass(fs, x) |
always(x) |
K(x) |
and(a, b) |
and(a, b) |
any(f, x) |
`` |
Douglas Crockford, author of JavaScript: The Good parts, recently gave a talk called The Better Parts, where he demonstrates how he creates objects in JavaScript nowadays. He doesn't call his approach anything, but I will refer to it as Crockford Classless.
Crockford Classless is completely free of class, new, this, prototype and even Crockfords own invention Object.create.
I think it's really, really sleek, and this is what it looks like:
function dog(spec) {
An introduction to functional thinking with examples in JavaScript.
https://medium.com/@chetcorcos/functional-programming-for-javascript-people-1915d8775504#.p0hyzlyjq
A soft, informal introduction to the Fantasy Land spec.
https://james-forbes.com/?/posts/the-perfect-api