This implementation can now be found in production here
This file contains 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
/** | |
* An action is the standard action that most | |
* applications deal with. It is typed, like TypedAction, but | |
* also has a payload associated with it. | |
*/ | |
export type Action<P = void> = { | |
readonly tag: string; | |
readonly payload: P; | |
}; |
This file contains 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
/** | |
* This is a quick attempt at a stack safe version | |
* of Fn. The unfortunate bit is that it relies on a | |
* central class for building and executing a lazy.. | |
* | |
* It's probably easy enough to create a typed tuple | |
* where we only track the input of the first control | |
* and the return of the last control. That's something | |
* to look into. | |
* |
This file contains 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
// deno-lint-ignore-file no-explicit-any | |
import * as RSS from "https://deno.land/x/rss@0.5.6/mod.ts"; | |
import * as TE from "https://raw.githubusercontent.com/baetheus/fun/main/task_either.ts"; | |
import { pipe } from "https://raw.githubusercontent.com/baetheus/fun/main/fns.ts"; | |
// --- | |
// Try implementing a reusable error type | |
// --- | |
export type TaggedError<T extends string, A> = { |
This file contains 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
/** | |
* An action is the standard action that most | |
* applications deal with. It is typed, like TypedAction, but | |
* also has a payload associated with it. | |
*/ | |
export type Action<P = void, T extends string = string> = { | |
readonly tag: T; | |
readonly payload: P; | |
}; |
This file contains 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
// See https://github.com/briancavalier/fx | |
export type Effect<T, A, R> = { | |
type: T; | |
arg: A; | |
[Symbol.iterator](): Generator<Effect<T, A, R>, R, R>; | |
}; | |
export function effect<T, A, R>(type: T, arg: A): Effect<T, A, R> { | |
return { |
This file contains 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
// deno-fmt-ignore-file no-explicit-any | |
import type { Iso } from "./iso.ts"; | |
import type { Lens } from "./lens.ts"; | |
import type { Prism } from "./prism.ts"; | |
import type { Optional } from "./optional.ts"; | |
import type { Traversal } from "./traversal.ts"; | |
import * as I from "./iso.ts"; | |
import * as L from "./lens.ts"; |
This file contains 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 type * as HKT from "./hkt.ts"; | |
import type * as TC from "./type_classes.ts"; | |
import { createDo } from "./derivations.ts"; | |
import { createSequenceStruct, createSequenceTuple } from "./sequence.ts"; | |
/******************************************************************************* | |
* Kind Registration | |
******************************************************************************/ |
This file contains 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 type * as HKT from "./hkt.ts"; | |
import type * as TC from "./type_classes.ts"; | |
import type { Option } from "./option.ts"; | |
import * as O from "./option.ts"; | |
import { Queue } from "./denque.ts"; | |
import { pipe } from "./fns.ts"; | |
/******************************************************************************* | |
* Types |
This file contains 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 type { Kind, URIS } from "./hkt.ts"; | |
import type * as TC from "./type_classes.ts"; | |
import { flow, pipe } from "./fns.ts"; | |
export type FunctorComposition<URI extends URIS, VRI extends URIS> = { | |
readonly map: <A, I>( | |
fai: (a: A) => I, | |
) => <B, C, D, E, F, G>( | |
ta: Kind<URI, [Kind<VRI, [A, B, C, D]>, E, F, G]>, | |
) => Kind<URI, [Kind<VRI, [I, B, C, D]>, E, F, G]>; |