@morphic-ts/model-algebras
Advanced tools
Comparing version 3.0.0-alpha.5 to 3.0.0-alpha.6
@@ -1,3 +0,3 @@ | ||
import type { Kind, URIS } from '@morphic-ts/common/es6//HKT'; | ||
import type { AnyEnv } from '@morphic-ts/common/es6/config'; | ||
import type { ConfigTypeKind, ConfigTypeURIS, HKT, Kind, URIS } from '@morphic-ts/common/es6//HKT'; | ||
import type { AnyEnv, ConfigsForType } from '@morphic-ts/common/es6/config'; | ||
import type { OfType, UnionToIntersection } from '@morphic-ts/common/es6/core'; | ||
@@ -18,13 +18,40 @@ /** | ||
/** | ||
* @since 0.0.1 | ||
*/ | ||
export interface IntersectionConfig<L extends readonly unknown[], A extends readonly unknown[]> { | ||
} | ||
/** | ||
* Map an Array of E and A to an Array of ConfigType for a particular URI | ||
* @since 0.0.1 | ||
*/ | ||
export declare type IntersectionLA<L extends readonly unknown[], A extends readonly unknown[], URI extends ConfigTypeURIS> = { | ||
[k in keyof L]: k extends keyof A ? ConfigTypeKind<URI, L[k], A[k]> : never; | ||
}; | ||
/** | ||
* Map some Props to their ConfigTypes for a particular URI | ||
* @since 0.0.1 | ||
*/ | ||
export declare type InterfaceLA<Props, URI extends ConfigTypeURIS> = { | ||
[k in keyof Props]: Props[k] extends HKT<infer R, infer E, infer A> ? ConfigTypeKind<URI, E, A> : never; | ||
}; | ||
/** | ||
* @since 0.0.1 | ||
*/ | ||
export interface ModelAlgebraIntersection<F extends URIS, Env extends AnyEnv> { | ||
_F: F; | ||
intersection: { | ||
<Types extends readonly OfType<F, any, any, Env>[]>(types: Types, name: string): Kind<F, Env, UnionToIntersection<{ | ||
<Types extends readonly OfType<F, any, any, Env>[]>(...types: Types): (name: string, config?: ConfigsForType<Env, UnionToIntersection<{ | ||
[k in keyof Types]: Types[k] extends OfType<F, infer LA, infer A, Env> ? unknown extends LA ? never : LA : never; | ||
}[number]>, UnionToIntersection<{ | ||
[k in keyof Types]: Types[k] extends OfType<F, infer LA, infer A, Env> ? unknown extends A ? never : A : never; | ||
}[number]>, IntersectionConfig<{ | ||
[k in keyof Types]: Types[k] extends OfType<F, infer LA, infer A, Env> ? LA : never; | ||
}, { | ||
[k in keyof Types]: Types[k] extends OfType<F, infer LA, infer A, Env> ? A : never; | ||
}>>) => Kind<F, Env, UnionToIntersection<{ | ||
[k in keyof Types]: Types[k] extends OfType<F, infer LA, infer A, Env> ? unknown extends LA ? never : LA : never; | ||
}[number]>, UnionToIntersection<{ | ||
[k in keyof Types]: Types[k] extends OfType<F, infer LA, infer A, Env> ? unknown extends A ? never : A : never; | ||
}[number]>>; | ||
}; | ||
} |
import type { AnyEnv, ConfigsForType } from '@morphic-ts/common/es6/config'; | ||
import type { Kind, URIS } from '@morphic-ts/common/es6/HKT'; | ||
import type { Iso, Prism } from 'monocle-ts'; | ||
import type { Newtype } from 'newtype-ts'; | ||
@@ -28,5 +29,32 @@ /** | ||
*/ | ||
export declare type AOfIso<X> = X extends Iso<infer S, infer A> ? A : never; | ||
/** | ||
* @since 0.0.1 | ||
*/ | ||
export declare type AOfPrism<X> = X extends Prism<infer S, infer A> ? A : never; | ||
/** | ||
* @since 0.0.1 | ||
*/ | ||
export interface NewtypeConfig<L, A, N> { | ||
} | ||
/** | ||
* @since 0.0.1 | ||
*/ | ||
export interface IsoConfig<L, A, N> { | ||
} | ||
/** | ||
* @since 0.0.1 | ||
*/ | ||
export interface PrismConfig<L, A, N> { | ||
} | ||
/** | ||
* @since 0.0.1 | ||
*/ | ||
export interface ModelAlgebraNewtype<F extends URIS, Env> { | ||
_F: F; | ||
newtype<N extends AnyNewtype = never>(name: string): <E>(a: Kind<F, Env, E, NewtypeA<N>>, config?: ConfigsForType<Env, E, N>) => Kind<F, Env, E, N>; | ||
newtype<N extends AnyNewtype = never>(name: string): <E>(a: Kind<F, Env, E, NewtypeA<N>>, config?: ConfigsForType<Env, E, N, NewtypeConfig<E, NewtypeA<N>, N>>) => Kind<F, Env, E, N>; | ||
newtypeIso<E, A, N extends Newtype<any, A>>(iso: Iso<A, N>, a: Kind<F, Env, E, A>, name: string, config?: ConfigsForType<Env, E, N, IsoConfig<E, A, N>>): Kind<F, Env, E, N>; | ||
newtypePrism: { | ||
<E, A, N extends Newtype<any, A>>(prism: Prism<A, N>, a: Kind<F, Env, E, A>, name: string, config?: ConfigsForType<Env, E, N, PrismConfig<E, A, N>>): Kind<F, Env, E, N>; | ||
}; | ||
} |
@@ -17,8 +17,21 @@ import type { AnyEnv, ConfigsForType } from '@morphic-ts/common/es6/config'; | ||
/** | ||
* @since 0.0.1 | ||
*/ | ||
export interface InterfaceConfig<Props> { | ||
} | ||
/** | ||
* @since 0.0.1 | ||
*/ | ||
export declare type PropsKind<F extends URIS, PropsA, PropsE, R> = Readonly<{ | ||
[k in keyof PropsA & keyof PropsE]: Kind<F, R, PropsA[k], PropsE[k]>; | ||
export interface PartialConfig<Props> { | ||
} | ||
/** | ||
* @since 0.0.1 | ||
*/ | ||
export interface BothConfig<Props, PropsPartial> { | ||
} | ||
/** | ||
* @since 0.0.1 | ||
*/ | ||
export declare type PropsKind<F extends URIS, PropsE, PropsA, R> = Readonly<{ | ||
[k in keyof PropsA & keyof PropsE]: Kind<F, R, PropsE[k], PropsA[k]>; | ||
}>; | ||
@@ -56,6 +69,10 @@ /** | ||
[k in keyof Props]: Props[k]['_A']; | ||
}>>) => Kind<F, Env, Readonly<{ | ||
}>, InterfaceConfig<PropsKind<F, Readonly<{ | ||
[k in keyof Props]: Props[k]['_E']; | ||
}>, Readonly<{ | ||
[k in keyof Props]: Props[k]['_A']; | ||
}>, Env>>>) => Kind<F, Env, Readonly<{ | ||
[k in keyof Props]: Props[k]['_E']; | ||
}>, Readonly<{ | ||
[k in keyof Props]: Props[k]['_A']; | ||
}>>; | ||
@@ -66,4 +83,8 @@ partial: <Props extends AnyProps<Props, Env>>(props: Props, name: string, config?: ConfigsForType<Env, Partial<Readonly<{ | ||
[k in keyof Props]: Props[k]['_A']; | ||
}>>>) => Kind<F, Env, Partial<{ | ||
}>>, PartialConfig<PropsKind<F, Partial<Readonly<{ | ||
[k in keyof Props]: Props[k]['_E']; | ||
}>>, Partial<Readonly<{ | ||
[k in keyof Props]: Props[k]['_A']; | ||
}>>, Env>>>) => Kind<F, Env, Partial<{ | ||
[k in keyof Props]: Props[k]['_E']; | ||
}>, Partial<{ | ||
@@ -76,11 +97,31 @@ [k in keyof Props]: Props[k]['_A']; | ||
[k in keyof Props]: Props[k]['_A']; | ||
}, Env>, partial: PropsKind<F, PropsE<PartialProps>, PropsA<PartialProps>, Env>, name: string, config?: ConfigsForType<Env, Readonly<{ | ||
}, Env>, partial: PropsKind<F, Partial<{ | ||
[k in keyof PartialProps]: PartialProps[k]['_E']; | ||
}>, Partial<{ | ||
[k in keyof PartialProps]: PartialProps[k]['_A']; | ||
}>, Env>, name: string, config?: ConfigsForType<Env, Readonly<{ | ||
[k in keyof Props]: Props[k]['_E']; | ||
} & Partial<PropsE<PartialProps>>>, Readonly<{ | ||
} & Partial<{ | ||
[k in keyof PartialProps]: PartialProps[k]['_E']; | ||
}>>, Readonly<{ | ||
[k in keyof Props]: Props[k]['_A']; | ||
} & Partial<PropsA<PartialProps>>>>) => Kind<F, Env, Readonly<{ | ||
} & Partial<{ | ||
[k in keyof PartialProps]: PartialProps[k]['_A']; | ||
}>>, BothConfig<PropsKind<F, Readonly<{ | ||
[k in keyof Props]: Props[k]['_E']; | ||
} & Partial<PropsE<PartialProps>>>, Readonly<{ | ||
}>, Readonly<{ | ||
[k in keyof Props]: Props[k]['_A']; | ||
} & Partial<PropsA<PartialProps>>>>; | ||
}>, Env>, PropsKind<F, Partial<Readonly<{ | ||
[k in keyof PartialProps]: PartialProps[k]['_E']; | ||
}>>, Partial<Readonly<{ | ||
[k in keyof PartialProps]: PartialProps[k]['_A']; | ||
}>>, Env>>>) => Kind<F, Env, Readonly<{ | ||
[k in keyof Props]: Props[k]['_E']; | ||
} & Partial<{ | ||
[k in keyof PartialProps]: PartialProps[k]['_E']; | ||
}>>, Readonly<{ | ||
[k in keyof Props]: Props[k]['_A']; | ||
} & Partial<{ | ||
[k in keyof PartialProps]: PartialProps[k]['_A']; | ||
}>>>; | ||
} |
@@ -17,2 +17,7 @@ import type { AnyEnv, ConfigsForType } from '@morphic-ts/common/es6/config'; | ||
/** | ||
* @since 0.0.1 | ||
*/ | ||
export interface RecursiveConfig<L, A> { | ||
} | ||
/** | ||
* @since 0.0.1 | ||
@@ -22,3 +27,3 @@ */ | ||
_F: F; | ||
recursive: <L, A>(a: (x: Kind<F, Env, L, A>) => Kind<F, Env, L, A>, name: string, config?: ConfigsForType<Env, L, A>) => Kind<F, Env, L, A>; | ||
recursive: <L, A>(a: (x: Kind<F, Env, L, A>) => Kind<F, Env, L, A>, name: string, config?: ConfigsForType<Env, L, A, RecursiveConfig<L, A>>) => Kind<F, Env, L, A>; | ||
} |
import type { AnyEnv, ConfigsForType } from '@morphic-ts/common/es6/config'; | ||
import type { Kind, URIS } from '@morphic-ts/common/es6/HKT'; | ||
import type { Refinement } from 'fp-ts/function'; | ||
import type { Predicate, Refinement } from 'fp-ts/function'; | ||
/** | ||
@@ -20,5 +20,16 @@ * @since 0.0.1 | ||
*/ | ||
export interface RefinedConfig<E, A, B> { | ||
} | ||
/** | ||
* @since 0.0.1 | ||
*/ | ||
export interface PredicateConfig<E, A> { | ||
} | ||
/** | ||
* @since 0.0.1 | ||
*/ | ||
export interface ModelAlgebraRefined<F extends URIS, Env extends AnyEnv> { | ||
_F: F; | ||
refined<E, A, B extends A>(a: Kind<F, Env, E, A>, refinement: Refinement<A, B>, name: string, config?: ConfigsForType<Env, E, B>): Kind<F, Env, E, B>; | ||
refined<E, A, B extends A>(a: Kind<F, Env, E, A>, refinement: Refinement<A, B>, name: string, config?: ConfigsForType<Env, E, B, RefinedConfig<E, A, B>>): Kind<F, Env, E, B>; | ||
constrained<E, A>(a: Kind<F, Env, E, A>, predicate: Predicate<A>, name: string, config?: ConfigsForType<Env, E, A, PredicateConfig<E, A>>): Kind<F, Env, E, A>; | ||
} |
@@ -13,2 +13,7 @@ import type { AnyEnv, ConfigsForType } from '@morphic-ts/common/es6/config'; | ||
export declare type SetURI = typeof SetURI; | ||
/** | ||
* @since 0.0.1 | ||
*/ | ||
export interface SetConfig<L, A> { | ||
} | ||
declare module '@morphic-ts/algebras/es6/hkt' { | ||
@@ -24,3 +29,3 @@ interface Algebra<F extends URIS, Env extends AnyEnv> { | ||
_F: F; | ||
set: <L, A>(a: Kind<F, Env, L, A>, ord: Ord<A>, config?: ConfigsForType<Env, Array<L>, Set<A>>) => Kind<F, Env, Array<L>, Set<A>>; | ||
set: <L, A>(a: Kind<F, Env, L, A>, ord: Ord<A>, config?: ConfigsForType<Env, Array<L>, Set<A>, SetConfig<L, A>>) => Kind<F, Env, Array<L>, Set<A>>; | ||
} |
@@ -19,6 +19,16 @@ import type { AnyEnv, ConfigsForType } from '@morphic-ts/common/es6/config'; | ||
*/ | ||
export interface StrMapConfig<L, A> { | ||
} | ||
/** | ||
* @since 0.0.1 | ||
*/ | ||
export interface RecordConfig<LA, A, LB, B> { | ||
} | ||
/** | ||
* @since 0.0.1 | ||
*/ | ||
export interface ModelAlgebraStrMap<F extends URIS, Env extends AnyEnv> { | ||
_F: F; | ||
strMap: <L, A>(codomain: Kind<F, Env, L, A>, config?: ConfigsForType<Env, Readonly<Record<string, L>>, Readonly<Record<string, A>>>) => Kind<F, Env, Readonly<Record<string, L>>, Readonly<Record<string, A>>>; | ||
record: <LA extends string, LB, A extends string, B>(domain: Kind<F, Env, LA, A>, codomain: Kind<F, Env, LB, B>, config?: ConfigsForType<Env, Readonly<Record<LA, LB>>, Readonly<Record<A, B>>>) => Kind<F, Env, Readonly<Record<LA, LB>>, Readonly<Record<A, B>>>; | ||
strMap: <L, A>(codomain: Kind<F, Env, L, A>, config?: ConfigsForType<Env, Readonly<Record<string, L>>, Readonly<Record<string, A>>, StrMapConfig<L, A>>) => Kind<F, Env, Readonly<Record<string, L>>, Readonly<Record<string, A>>>; | ||
record: <LA extends string, LB, A extends string, B>(domain: Kind<F, Env, LA, A>, codomain: Kind<F, Env, LB, B>, config?: ConfigsForType<Env, Readonly<Record<LA, LB>>, Readonly<Record<A, B>>, RecordConfig<LA, A, LB, B>>) => Kind<F, Env, Readonly<Record<LA, LB>>, Readonly<Record<A, B>>>; | ||
} |
@@ -19,2 +19,7 @@ import type { AnyEnv, ConfigsForType } from '@morphic-ts/common/es6/config'; | ||
*/ | ||
export interface TaggedUnionConfig<Types> { | ||
} | ||
/** | ||
* @since 0.0.1 | ||
*/ | ||
declare type TaggedTypes<F extends URIS, X, R> = { | ||
@@ -35,5 +40,5 @@ [o in keyof X]: Kind<F, R, any, any>; | ||
taggedUnion: { | ||
<Tag extends string, Types extends TaggedTypes<F, any, Env>>(tag: Tag, types: Types, name: string, config?: ConfigsForType<Env, PropsE<Types>, PropsA<Types>>): Kind<F, Env, PropsE<Types>, PropsA<Types>>; | ||
<Tag extends string, Types extends TaggedTypes<F, any, Env>>(tag: Tag, types: Types, name: string, config?: ConfigsForType<Env, PropsE<Types>, PropsA<Types>, TaggedUnionConfig<Types>>): Kind<F, Env, PropsE<Types>, PropsA<Types>>; | ||
}; | ||
} | ||
export {}; |
@@ -23,5 +23,10 @@ import type { AnyEnv, ConfigsForType } from '@morphic-ts/common/es6/config'; | ||
*/ | ||
export interface UnknownConfig { | ||
} | ||
/** | ||
* @since 0.0.1 | ||
*/ | ||
export interface ModelAlgebraUnknown<F extends URIS, Env extends AnyEnv> { | ||
_F: F; | ||
unknown(config?: ConfigsForType<Env, unknown, unknown>): Kind<F, Env, unknown, unknown>; | ||
unknown(config?: ConfigsForType<Env, unknown, unknown, UnknownConfig>): Kind<F, Env, unknown, unknown>; | ||
} |
@@ -1,3 +0,3 @@ | ||
import type { Kind, URIS } from '@morphic-ts/common/lib//HKT'; | ||
import type { AnyEnv } from '@morphic-ts/common/lib/config'; | ||
import type { ConfigTypeKind, ConfigTypeURIS, HKT, Kind, URIS } from '@morphic-ts/common/lib//HKT'; | ||
import type { AnyEnv, ConfigsForType } from '@morphic-ts/common/lib/config'; | ||
import type { OfType, UnionToIntersection } from '@morphic-ts/common/lib/core'; | ||
@@ -18,13 +18,40 @@ /** | ||
/** | ||
* @since 0.0.1 | ||
*/ | ||
export interface IntersectionConfig<L extends readonly unknown[], A extends readonly unknown[]> { | ||
} | ||
/** | ||
* Map an Array of E and A to an Array of ConfigType for a particular URI | ||
* @since 0.0.1 | ||
*/ | ||
export declare type IntersectionLA<L extends readonly unknown[], A extends readonly unknown[], URI extends ConfigTypeURIS> = { | ||
[k in keyof L]: k extends keyof A ? ConfigTypeKind<URI, L[k], A[k]> : never; | ||
}; | ||
/** | ||
* Map some Props to their ConfigTypes for a particular URI | ||
* @since 0.0.1 | ||
*/ | ||
export declare type InterfaceLA<Props, URI extends ConfigTypeURIS> = { | ||
[k in keyof Props]: Props[k] extends HKT<infer R, infer E, infer A> ? ConfigTypeKind<URI, E, A> : never; | ||
}; | ||
/** | ||
* @since 0.0.1 | ||
*/ | ||
export interface ModelAlgebraIntersection<F extends URIS, Env extends AnyEnv> { | ||
_F: F; | ||
intersection: { | ||
<Types extends readonly OfType<F, any, any, Env>[]>(types: Types, name: string): Kind<F, Env, UnionToIntersection<{ | ||
<Types extends readonly OfType<F, any, any, Env>[]>(...types: Types): (name: string, config?: ConfigsForType<Env, UnionToIntersection<{ | ||
[k in keyof Types]: Types[k] extends OfType<F, infer LA, infer A, Env> ? unknown extends LA ? never : LA : never; | ||
}[number]>, UnionToIntersection<{ | ||
[k in keyof Types]: Types[k] extends OfType<F, infer LA, infer A, Env> ? unknown extends A ? never : A : never; | ||
}[number]>, IntersectionConfig<{ | ||
[k in keyof Types]: Types[k] extends OfType<F, infer LA, infer A, Env> ? LA : never; | ||
}, { | ||
[k in keyof Types]: Types[k] extends OfType<F, infer LA, infer A, Env> ? A : never; | ||
}>>) => Kind<F, Env, UnionToIntersection<{ | ||
[k in keyof Types]: Types[k] extends OfType<F, infer LA, infer A, Env> ? unknown extends LA ? never : LA : never; | ||
}[number]>, UnionToIntersection<{ | ||
[k in keyof Types]: Types[k] extends OfType<F, infer LA, infer A, Env> ? unknown extends A ? never : A : never; | ||
}[number]>>; | ||
}; | ||
} |
import type { AnyEnv, ConfigsForType } from '@morphic-ts/common/lib/config'; | ||
import type { Kind, URIS } from '@morphic-ts/common/lib/HKT'; | ||
import type { Iso, Prism } from 'monocle-ts'; | ||
import type { Newtype } from 'newtype-ts'; | ||
@@ -28,5 +29,32 @@ /** | ||
*/ | ||
export declare type AOfIso<X> = X extends Iso<infer S, infer A> ? A : never; | ||
/** | ||
* @since 0.0.1 | ||
*/ | ||
export declare type AOfPrism<X> = X extends Prism<infer S, infer A> ? A : never; | ||
/** | ||
* @since 0.0.1 | ||
*/ | ||
export interface NewtypeConfig<L, A, N> { | ||
} | ||
/** | ||
* @since 0.0.1 | ||
*/ | ||
export interface IsoConfig<L, A, N> { | ||
} | ||
/** | ||
* @since 0.0.1 | ||
*/ | ||
export interface PrismConfig<L, A, N> { | ||
} | ||
/** | ||
* @since 0.0.1 | ||
*/ | ||
export interface ModelAlgebraNewtype<F extends URIS, Env> { | ||
_F: F; | ||
newtype<N extends AnyNewtype = never>(name: string): <E>(a: Kind<F, Env, E, NewtypeA<N>>, config?: ConfigsForType<Env, E, N>) => Kind<F, Env, E, N>; | ||
newtype<N extends AnyNewtype = never>(name: string): <E>(a: Kind<F, Env, E, NewtypeA<N>>, config?: ConfigsForType<Env, E, N, NewtypeConfig<E, NewtypeA<N>, N>>) => Kind<F, Env, E, N>; | ||
newtypeIso<E, A, N extends Newtype<any, A>>(iso: Iso<A, N>, a: Kind<F, Env, E, A>, name: string, config?: ConfigsForType<Env, E, N, IsoConfig<E, A, N>>): Kind<F, Env, E, N>; | ||
newtypePrism: { | ||
<E, A, N extends Newtype<any, A>>(prism: Prism<A, N>, a: Kind<F, Env, E, A>, name: string, config?: ConfigsForType<Env, E, N, PrismConfig<E, A, N>>): Kind<F, Env, E, N>; | ||
}; | ||
} |
@@ -17,8 +17,21 @@ import type { AnyEnv, ConfigsForType } from '@morphic-ts/common/lib/config'; | ||
/** | ||
* @since 0.0.1 | ||
*/ | ||
export interface InterfaceConfig<Props> { | ||
} | ||
/** | ||
* @since 0.0.1 | ||
*/ | ||
export declare type PropsKind<F extends URIS, PropsA, PropsE, R> = Readonly<{ | ||
[k in keyof PropsA & keyof PropsE]: Kind<F, R, PropsA[k], PropsE[k]>; | ||
export interface PartialConfig<Props> { | ||
} | ||
/** | ||
* @since 0.0.1 | ||
*/ | ||
export interface BothConfig<Props, PropsPartial> { | ||
} | ||
/** | ||
* @since 0.0.1 | ||
*/ | ||
export declare type PropsKind<F extends URIS, PropsE, PropsA, R> = Readonly<{ | ||
[k in keyof PropsA & keyof PropsE]: Kind<F, R, PropsE[k], PropsA[k]>; | ||
}>; | ||
@@ -56,6 +69,10 @@ /** | ||
[k in keyof Props]: Props[k]['_A']; | ||
}>>) => Kind<F, Env, Readonly<{ | ||
}>, InterfaceConfig<PropsKind<F, Readonly<{ | ||
[k in keyof Props]: Props[k]['_E']; | ||
}>, Readonly<{ | ||
[k in keyof Props]: Props[k]['_A']; | ||
}>, Env>>>) => Kind<F, Env, Readonly<{ | ||
[k in keyof Props]: Props[k]['_E']; | ||
}>, Readonly<{ | ||
[k in keyof Props]: Props[k]['_A']; | ||
}>>; | ||
@@ -66,4 +83,8 @@ partial: <Props extends AnyProps<Props, Env>>(props: Props, name: string, config?: ConfigsForType<Env, Partial<Readonly<{ | ||
[k in keyof Props]: Props[k]['_A']; | ||
}>>>) => Kind<F, Env, Partial<{ | ||
}>>, PartialConfig<PropsKind<F, Partial<Readonly<{ | ||
[k in keyof Props]: Props[k]['_E']; | ||
}>>, Partial<Readonly<{ | ||
[k in keyof Props]: Props[k]['_A']; | ||
}>>, Env>>>) => Kind<F, Env, Partial<{ | ||
[k in keyof Props]: Props[k]['_E']; | ||
}>, Partial<{ | ||
@@ -76,11 +97,31 @@ [k in keyof Props]: Props[k]['_A']; | ||
[k in keyof Props]: Props[k]['_A']; | ||
}, Env>, partial: PropsKind<F, PropsE<PartialProps>, PropsA<PartialProps>, Env>, name: string, config?: ConfigsForType<Env, Readonly<{ | ||
}, Env>, partial: PropsKind<F, Partial<{ | ||
[k in keyof PartialProps]: PartialProps[k]['_E']; | ||
}>, Partial<{ | ||
[k in keyof PartialProps]: PartialProps[k]['_A']; | ||
}>, Env>, name: string, config?: ConfigsForType<Env, Readonly<{ | ||
[k in keyof Props]: Props[k]['_E']; | ||
} & Partial<PropsE<PartialProps>>>, Readonly<{ | ||
} & Partial<{ | ||
[k in keyof PartialProps]: PartialProps[k]['_E']; | ||
}>>, Readonly<{ | ||
[k in keyof Props]: Props[k]['_A']; | ||
} & Partial<PropsA<PartialProps>>>>) => Kind<F, Env, Readonly<{ | ||
} & Partial<{ | ||
[k in keyof PartialProps]: PartialProps[k]['_A']; | ||
}>>, BothConfig<PropsKind<F, Readonly<{ | ||
[k in keyof Props]: Props[k]['_E']; | ||
} & Partial<PropsE<PartialProps>>>, Readonly<{ | ||
}>, Readonly<{ | ||
[k in keyof Props]: Props[k]['_A']; | ||
} & Partial<PropsA<PartialProps>>>>; | ||
}>, Env>, PropsKind<F, Partial<Readonly<{ | ||
[k in keyof PartialProps]: PartialProps[k]['_E']; | ||
}>>, Partial<Readonly<{ | ||
[k in keyof PartialProps]: PartialProps[k]['_A']; | ||
}>>, Env>>>) => Kind<F, Env, Readonly<{ | ||
[k in keyof Props]: Props[k]['_E']; | ||
} & Partial<{ | ||
[k in keyof PartialProps]: PartialProps[k]['_E']; | ||
}>>, Readonly<{ | ||
[k in keyof Props]: Props[k]['_A']; | ||
} & Partial<{ | ||
[k in keyof PartialProps]: PartialProps[k]['_A']; | ||
}>>>; | ||
} |
@@ -17,2 +17,7 @@ import type { AnyEnv, ConfigsForType } from '@morphic-ts/common/lib/config'; | ||
/** | ||
* @since 0.0.1 | ||
*/ | ||
export interface RecursiveConfig<L, A> { | ||
} | ||
/** | ||
* @since 0.0.1 | ||
@@ -22,3 +27,3 @@ */ | ||
_F: F; | ||
recursive: <L, A>(a: (x: Kind<F, Env, L, A>) => Kind<F, Env, L, A>, name: string, config?: ConfigsForType<Env, L, A>) => Kind<F, Env, L, A>; | ||
recursive: <L, A>(a: (x: Kind<F, Env, L, A>) => Kind<F, Env, L, A>, name: string, config?: ConfigsForType<Env, L, A, RecursiveConfig<L, A>>) => Kind<F, Env, L, A>; | ||
} |
import type { AnyEnv, ConfigsForType } from '@morphic-ts/common/lib/config'; | ||
import type { Kind, URIS } from '@morphic-ts/common/lib/HKT'; | ||
import type { Refinement } from 'fp-ts/function'; | ||
import type { Predicate, Refinement } from 'fp-ts/function'; | ||
/** | ||
@@ -20,5 +20,16 @@ * @since 0.0.1 | ||
*/ | ||
export interface RefinedConfig<E, A, B> { | ||
} | ||
/** | ||
* @since 0.0.1 | ||
*/ | ||
export interface PredicateConfig<E, A> { | ||
} | ||
/** | ||
* @since 0.0.1 | ||
*/ | ||
export interface ModelAlgebraRefined<F extends URIS, Env extends AnyEnv> { | ||
_F: F; | ||
refined<E, A, B extends A>(a: Kind<F, Env, E, A>, refinement: Refinement<A, B>, name: string, config?: ConfigsForType<Env, E, B>): Kind<F, Env, E, B>; | ||
refined<E, A, B extends A>(a: Kind<F, Env, E, A>, refinement: Refinement<A, B>, name: string, config?: ConfigsForType<Env, E, B, RefinedConfig<E, A, B>>): Kind<F, Env, E, B>; | ||
constrained<E, A>(a: Kind<F, Env, E, A>, predicate: Predicate<A>, name: string, config?: ConfigsForType<Env, E, A, PredicateConfig<E, A>>): Kind<F, Env, E, A>; | ||
} |
@@ -13,2 +13,7 @@ import type { AnyEnv, ConfigsForType } from '@morphic-ts/common/lib/config'; | ||
export declare type SetURI = typeof SetURI; | ||
/** | ||
* @since 0.0.1 | ||
*/ | ||
export interface SetConfig<L, A> { | ||
} | ||
declare module '@morphic-ts/algebras/lib/hkt' { | ||
@@ -24,3 +29,3 @@ interface Algebra<F extends URIS, Env extends AnyEnv> { | ||
_F: F; | ||
set: <L, A>(a: Kind<F, Env, L, A>, ord: Ord<A>, config?: ConfigsForType<Env, Array<L>, Set<A>>) => Kind<F, Env, Array<L>, Set<A>>; | ||
set: <L, A>(a: Kind<F, Env, L, A>, ord: Ord<A>, config?: ConfigsForType<Env, Array<L>, Set<A>, SetConfig<L, A>>) => Kind<F, Env, Array<L>, Set<A>>; | ||
} |
@@ -19,6 +19,16 @@ import type { AnyEnv, ConfigsForType } from '@morphic-ts/common/lib/config'; | ||
*/ | ||
export interface StrMapConfig<L, A> { | ||
} | ||
/** | ||
* @since 0.0.1 | ||
*/ | ||
export interface RecordConfig<LA, A, LB, B> { | ||
} | ||
/** | ||
* @since 0.0.1 | ||
*/ | ||
export interface ModelAlgebraStrMap<F extends URIS, Env extends AnyEnv> { | ||
_F: F; | ||
strMap: <L, A>(codomain: Kind<F, Env, L, A>, config?: ConfigsForType<Env, Readonly<Record<string, L>>, Readonly<Record<string, A>>>) => Kind<F, Env, Readonly<Record<string, L>>, Readonly<Record<string, A>>>; | ||
record: <LA extends string, LB, A extends string, B>(domain: Kind<F, Env, LA, A>, codomain: Kind<F, Env, LB, B>, config?: ConfigsForType<Env, Readonly<Record<LA, LB>>, Readonly<Record<A, B>>>) => Kind<F, Env, Readonly<Record<LA, LB>>, Readonly<Record<A, B>>>; | ||
strMap: <L, A>(codomain: Kind<F, Env, L, A>, config?: ConfigsForType<Env, Readonly<Record<string, L>>, Readonly<Record<string, A>>, StrMapConfig<L, A>>) => Kind<F, Env, Readonly<Record<string, L>>, Readonly<Record<string, A>>>; | ||
record: <LA extends string, LB, A extends string, B>(domain: Kind<F, Env, LA, A>, codomain: Kind<F, Env, LB, B>, config?: ConfigsForType<Env, Readonly<Record<LA, LB>>, Readonly<Record<A, B>>, RecordConfig<LA, A, LB, B>>) => Kind<F, Env, Readonly<Record<LA, LB>>, Readonly<Record<A, B>>>; | ||
} |
@@ -19,2 +19,7 @@ import type { AnyEnv, ConfigsForType } from '@morphic-ts/common/lib/config'; | ||
*/ | ||
export interface TaggedUnionConfig<Types> { | ||
} | ||
/** | ||
* @since 0.0.1 | ||
*/ | ||
declare type TaggedTypes<F extends URIS, X, R> = { | ||
@@ -35,5 +40,5 @@ [o in keyof X]: Kind<F, R, any, any>; | ||
taggedUnion: { | ||
<Tag extends string, Types extends TaggedTypes<F, any, Env>>(tag: Tag, types: Types, name: string, config?: ConfigsForType<Env, PropsE<Types>, PropsA<Types>>): Kind<F, Env, PropsE<Types>, PropsA<Types>>; | ||
<Tag extends string, Types extends TaggedTypes<F, any, Env>>(tag: Tag, types: Types, name: string, config?: ConfigsForType<Env, PropsE<Types>, PropsA<Types>, TaggedUnionConfig<Types>>): Kind<F, Env, PropsE<Types>, PropsA<Types>>; | ||
}; | ||
} | ||
export {}; |
@@ -23,5 +23,10 @@ import type { AnyEnv, ConfigsForType } from '@morphic-ts/common/lib/config'; | ||
*/ | ||
export interface UnknownConfig { | ||
} | ||
/** | ||
* @since 0.0.1 | ||
*/ | ||
export interface ModelAlgebraUnknown<F extends URIS, Env extends AnyEnv> { | ||
_F: F; | ||
unknown(config?: ConfigsForType<Env, unknown, unknown>): Kind<F, Env, unknown, unknown>; | ||
unknown(config?: ConfigsForType<Env, unknown, unknown, UnknownConfig>): Kind<F, Env, unknown, unknown>; | ||
} |
{ | ||
"name": "@morphic-ts/model-algebras", | ||
"version": "3.0.0-alpha.5", | ||
"version": "3.0.0-alpha.6", | ||
"description": "Morphic definitions for models", | ||
@@ -24,4 +24,4 @@ "author": "Stéphane Le Dorze <stephane.ledorze@gmail.com>", | ||
"dependencies": { | ||
"@morphic-ts/algebras": "^3.0.0-alpha.4", | ||
"@morphic-ts/common": "^3.0.0-alpha.4" | ||
"@morphic-ts/algebras": "^3.0.0-alpha.5", | ||
"@morphic-ts/common": "^3.0.0-alpha.5" | ||
}, | ||
@@ -70,3 +70,3 @@ "devDependencies": { | ||
}, | ||
"gitHead": "d489f4fffb9287128d361226f030485f9aadd9e4" | ||
"gitHead": "6814d93b5dcebaaea723702136acb47a3ba15d2e" | ||
} |
46935
1383