Skip to content

Instantly share code, notes, and snippets.

View miwillhite's full-sized avatar

Matthew Willhite miwillhite

View GitHub Profile
@miwillhite
miwillhite / articles.md
Last active April 10, 2023 22:40
Functional JavaScript (and other)
import { async, hold } from 'most-subject';
import reducer from './reducer';
const initialState = {};
// :: AsyncSubject
const store = hold(1, async());
// :: Action -> ()
export const next = store.next.bind(store);
// :: AsyncSubject State
export const state = store.scan(reducer, initialState);
// :: ReactComponent -> ReactComponent -> ReactComponent
const concatR = A => B =>
({ ...props, children }) =>
<>
<A { ...props } { ...children } />
<B { ...props } { ...children } />
</>
// :: ReactComponent
const EmptyComponent = <></>;
@miwillhite
miwillhite / gist:04ac6ccf9abf9bac3ec398e7512adf20
Created March 12, 2018 15:38
TypeError: Cannot read property 'forEach' of undefined
Node {
type: 'BlockStatement',
start: 1059,
end: 1171,
loc:
SourceLocation {
start: Position { line: 32, column: 50 },
end: Position { line: 40, column: 1 } },
range: [ 1059, 1171 ],
body:
@miwillhite
miwillhite / validation.js
Last active December 3, 2020 00:50
A naïve Validation ADT implementation in JS vs ReasonML vs PureScript
/*
JavaScript
There are 2 files.
1) The ADT definition.
Here we define the data constructors, their properties and the
implemenations (or "instances") of the various methods, in this
case "concat".

Keybase proof

I hereby claim:

  • I am miwillhite on github.
  • I am mwillhite (https://keybase.io/mwillhite) on keybase.
  • I have a public key ASAvBE9hF9gAxNjmuh0Ixd5nS7rNvLyZC8aWYzCroFR5tAo

To claim this, I am signing this object: