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
#!/usr/bin/env bash | |
node_modules/.bin/flow status --show-all-errors --message-width=80 --no-auto-start --timeout=15 --strip-root --color=always |
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
//@flow | |
import {interpret} from './wrap' | |
const foo = () => interpret(new Set([0, 1, 2])) | |
.map(x => x + 1) | |
.ap( interpret(new Set([x => x * 10])) ) |
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
//@flow | |
const Unit = _ => Unit | |
Object.assign(Unit, { | |
pred: _ => false, | |
scope: Unit, | |
block: Unit, | |
body: Unit, | |
read: Unit, |
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
//@flow | |
type R<+_> = (_: any) => _ | |
type W<-_> = (_: _) => any | |
type RR<-a, -b, +c> = (a: R<a>, b: R<b>) => R<c> | |
type WW<+a, +b, -c> = (a: W<a>, b: W<b>) => W<c> | |
type R$map<-a, +b> = (a: R<a>) => R<b> | |
type W$map<+a, -b> = (a: W<a>) => W<b> |
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
//@flow | |
export class MultiMap<A, B, C> { | |
/*::+*/ inner: Map<A, Map<B, C>> = new Map() | |
get(a: A, b: B): C | void { | |
const subset = this.inner.get(a) | |
if (subset === undefined) return | |
return subset.get(b) | |
} | |
set(a: A, b: B, c: C) { |
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 toposortDFS(edges, begin){ | |
const inEdges = new Map() | |
const outEdges = new Map() | |
const vertices = new Set() | |
const result = new Set() | |
for (const [edge, dep] of edges) { | |
vertices.add(edge) | |
vertices.add(dep) | |
} | |
for (const vertex of vertices) { |
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
//@flow | |
export type ExtractReturn<Fn> = $Call<<T>((...Iterable<any>) => T) => T, Fn>; | |
//example | |
const mapDispatchToProps = (dispatch: Dispatch) => ({ | |
actions: { | |
setCompany: ({ companyId, domainName }) => | |
dispatch( |
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
//@flow | |
class Foo<Properties: Object> { | |
$key: $Keys<Properties> | 'c'; | |
$value: $Values<Properties>; | |
} |
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
//@flow | |
import { | |
createEvent, | |
createStore, | |
combine, | |
type Event, | |
type Store, | |
} from 'effector' |
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 graph_term('a) = { | |
nodes: list('a), | |
edges: list(('a, 'a)), | |
}; | |
let example_graph = { | |
nodes: ['b', 'c', 'd', 'f', 'g', 'h', 'k'], | |
edges: [('h', 'g'), ('k', 'f'), ('f', 'b'), ('f', 'c'), ('c', 'b')], | |
}; |