export const HashSetPatchSym = Symbol.for("@Differ.HashSet.Patch") export type HashSetPatchSym = typeof HashSetPatchSym export const HashSetPatchValueSym = Symbol.for("@Differ.HashSet.Patch.Value") export type HashSetPatchValueSym = typeof HashSetPatchValueSym /** * A patch which describes updates to a set of values. * * @tsplus type Differ.HashSet.Patch */ export interface HashSetPatch { readonly [HashSetPatchSym]: HashSetPatchSym readonly [HashSetPatchValueSym]: (_: Value) => Value } /** * @tsplus type Differ.HashSet.Patch.Ops */ export interface HashSetPatchOps { readonly $: HashSetPatchAspects } /** * @tsplus static Differ.Ops HashSet */ export const HashSetPatch: HashSetPatchOps = { $: {} } /** * @tsplus type Differ.HashSet.Patch.Aspects */ export interface HashSetPatchAspects {} /** * @tsplus unify Differ.HashSet.Patch */ export function unifyHashSetPatch>(self: X): HashSetPatch< [X] extends [{ [HashSetPatchValueSym]: (_: infer Value) => infer Value }] ? Value : never > { return self } export abstract class BaseHashSetPatch implements HashSetPatch { readonly [HashSetPatchSym]: HashSetPatchSym = HashSetPatchSym readonly [HashSetPatchValueSym]!: (_: Value) => Value } export class AddHashSetPatch extends BaseHashSetPatch { readonly _tag = "Add" constructor(readonly value: Value) { super() } } export class AndThenHashSetPatch extends BaseHashSetPatch { readonly _tag = "AndThen" constructor(readonly first: HashSetPatch, readonly second: HashSetPatch) { super() } } export class EmptyHashSetPatch extends BaseHashSetPatch { readonly _tag = "Empty" } export class RemoveHashSetPatch extends BaseHashSetPatch { readonly _tag = "Remove" constructor(readonly value: Value) { super() } } export type HashSetPatchInstruction = | AddHashSetPatch | AndThenHashSetPatch | EmptyHashSetPatch | RemoveHashSetPatch /** * @tsplus macro identity */ export function hashSetPatchInstruction(self: HashSetPatch): HashSetPatchInstruction { // @ts-expect-error return self }