import { Materialized, Morph } from './materializer'; import { HKT2 } from '../common/HKT'; import { TagsOf, InhabitedTypes, AType, EType } from './utils'; import { Algebra } from '../algebras/hkt'; import { InterpreterURI } from './InterpreterResult'; import { TaggedUnionsURI } from '../model-algebras/tagged-unions'; import { ProgramURI, ProgramType } from './ProgramType'; import { ADT } from '../adt'; import { ElemType } from '../adt/utils'; export declare type TaggedUnionProg = ProgramType[ProgURI] & ((a: Algebra[TaggedUnionsURI]) => HKT2); declare type M = Materialized; declare type AnyTypes = Record>; declare type TagType = TagsOf> & string; export declare type UnionTypes = { [k in keyof Types]: M, AType & { [t in Tag]: k; }, ProgURI, InterpURI>; }; export declare function makeTagged(summ: (F: TaggedUnionProg) => M): (tag: Tag) => >(o: Types) => MorphADT<{ [k in keyof Types]: Types[k] extends InhabitedTypes ? [E, A] : never; }, TagType, ProgURI, InterpURI>; export declare type EOfTypes = Types[keyof Types][0]; export declare type AOfTypes = Types[keyof Types][1]; /** * Extracts the type of `A` for a given Morph type */ export declare type AOfMorhpADT> = T extends MorphADT ? AOfTypes : never; /** * Extracts the type of `E` for a given Morph type */ export declare type EOfMorhpADT> = T extends MorphADT ? EOfTypes : never; export declare type MorphADT = ADT, Tag> & Morph, AOfTypes, InterpURI, ProgURI> & { selectMorph: (keys: Keys) => MorphADT<{ [k in Extract>]: Types[k]; }, Tag, ProgURI, InterpURI>; excludeMorph: (keys: Keys) => MorphADT<{ [k in Exclude>]: Types[k]; }, Tag, ProgURI, InterpURI>; }; export {};