- Open https://astexplorer.net/
- Set it to JavaScript if it's not
- Set it to babylon6
- Paste the
source.js
code in the top left pane - In the "Transform" menu on the top select
babel6
- Copy the
transform.js
code in the bottom left page
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 c = directCell( x => console.log('a')) | |
c(1, 1) // nothing | |
c(1, 0) // 'a' | |
effect( next => cell( state => ).pipe(cell(x => y)) void )) | |
const a = Arrow( id ) | |
a.product(a).product(a)([1, [2, 3]]) |
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 { createType } from './type' | |
import type {Data, Type, TypeChecker} from './type' | |
type IncT = Type<'Inc', number> | |
type DecT = Type<'Dec', number> | |
type ResetT = Type<'Reset', number> | |
type WhatT = Type<'What', number> | |
const IncAction: Data<IncT, number> = createType('Inc') | |
const DecAction: Data<DecT, number> = createType('Dec') | |
const ResetAction: Data<ResetT, number> = createType('Reset') |
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 createType = name => { | |
const of = x => Object.freeze({ | |
'@@type': name, | |
fold: f => f(x), | |
map: f => of(f(x)), | |
inspect: () => `${name}(${x})` | |
}) | |
return {of} | |
} |
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
withUncontrolledProp({ | |
prop: 'checked', | |
defaultProp: 'autoChecked', | |
handlers: { | |
onClick: (previousProps) => !previousProps.checked | |
} | |
})(CustomCheckbox) |
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
class CustomCheckbox extends Component { | |
constructor () { | |
super() | |
this.state = { | |
checked: false | |
} | |
} | |
componentWillMount () { |
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 CustomCheckbox ({ onClick, checked }) { | |
return <div onClick={onClick}> | |
{checked ? 'Checked' : 'Not checked'} | |
</div> | |
} |
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 Cell = f => { | |
const _c = Arrow((x, [h, t]) => { | |
const fx = f(x) | |
cond( | |
[() => fx === h, Left([h, t])]] | |
[true, Right([fx, 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
# Assumes that: | |
# - You are on the master branch | |
# - Your dist npm task puts things into the dist/ folder | |
gh-pages: | |
-git checkout -b gh-pages | |
git checkout gh-pages | |
git merge master | |
npm run dist | |
cp dist/* . | |
git add . && git commit -m "♻️ 📄" |
- "Laws" test suite: run flowtyped functions to verify that a "monoid" (for example) really follows the laws for its
empty
andconcat
operations.