Skip to content

Instantly share code, notes, and snippets.

View kriskowal's full-sized avatar

Kris Kowal kriskowal

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
const streamWithContext = (context, stream) => ({
async next(value) {
return Promise.race([context.cancelled, stream.next(await value)]);
},
async return(value) {
return Promise.race([context.cancelled, stream.return(await value)]);
},
async throw(error) {
return Promise.race([context.cancelled, stream.throw(await error)]);
},
import { makeStream, nullQueue } from '@endo/stream';
/**
* @template TValue
*/
const makePubSub = () => {
// Request pubsub async queue internals
let { promise: tailPromise, resolve: tailResolve } = makePromiseKit();
import { makeStream, nullQueue } from '@endo/stream';
/**
* @template TValue
*/
const makePubSub = () => {
// Request pubsub async queue internals
let { promise: tailPromise, resolve: tailResolve } = makePromiseKit();
const makeNearReader = reader =>
Far('Reader', {
async next() {
const iteration = await reader.next();
if (iteration.done) {
return iteration;
}
return harden({ value: encodeBase64(iteration.value) });
},
async return(value) {
{
"colors": {
"darkBlue": "#61B2E4",
"darkRed": "#D22F27",
"darkGreen": "#5C9E31",
"lightPurple": "#B399C8"
},
"levels": [
{
"topology": "torus",
/**
* @template T
* @typedef {object} Schema
* @prop {() => T} number
* @prop {() => T} boolean
* @prop {() => T} string
* @prop {(t: T) => T} optional
* @prop {(t: T) => T} list
* @prop {(t: T) => T} dict
* @prop {(shape: Record<string, T>) => T} struct
{
"colors": {
"lightBlue": "#92D3F5",
"darkBlue": "#61B2E4",
"lightRed": "#EA5A47",
"darkRed": "#D22F27",
"lightGreen": "#B14CC3",
"darkGreen": "#5C9E31",
"lightYellow": "#FCEA2B",
"darkYellow": "#F1B31C",

Module Harmony Dependency Graph

graph LR;

subgraph Compartments Layer 0

  ModuleSourceConcept[module source concept];

  ModuleSourceInstance[ModuleSource instance];