type t<'pack> = {pack: 'pack, close: unit => unit}
let pack: t<'pack> => 'pack
let close: (t<'pack>, unit) => unit
let map: (t<'a>, 'a => 'b) => t<'b>
type dyn<'a> = Rxjs.Observable.t<Rxjs.Observable.t<'a>>
type t<'a> = {first: 'a, dyn: dyn<'a>}
let first: t<'a> => 'a
let dyn: t<'a> => dyn<'a>
let map: (t<'a>, 'a => 'b) => t<'b>
let return: 'a => Rxjs.t<Rxjs.foreign, Rxjs.void, 'a>
let fromPromise: Js.Promise.t<'a> => Rxjs.t<Rxjs.foreign, Rxjs.void, 'a>
let toPromise: Rxjs.t<'a, 'b, 'c> => Js.Promise.t<'c>
let toHistory: Rxjs.t<'c, 's, 'out> => Js.Promise.t<Array.t<'out>>
let startWith: (Rxjs.t<'a, 'b, 'c>, 'c) => Rxjs.t<'a, 'b, 'c>
`let combineLatest: array< Rxjs.t<Rxjs.foreign, Rxjs.void, ‘a>,
=> Rxjs.t<Rxjs.foreign, Rxjs.void, array<’a»`
let combineLatest2: (
(Rxjs.t<'a, 'b, 'c>, Rxjs.t<'d, 'e, 'f>),
) => Rxjs.t<Rxjs.foreign, Rxjs.void, ('c, 'f)>
let combineLatest3: (
(
Rxjs.t<'a, 'b, 'c>,
Rxjs.t<'d, 'e, 'f>,
Rxjs.t<'g, 'h, 'i>,
),
) => Rxjs.t<Rxjs.foreign, Rxjs.void, ('c, 'f, 'i)>
let combineLatest4: (
(
Rxjs.t<'a, 'b, 'c>,
Rxjs.t<'d, 'e, 'f>,
Rxjs.t<'g, 'h, 'i>,
Rxjs.t<'j, 'k, 'l>,
),
) => Rxjs.t<Rxjs.foreign, Rxjs.void, ('c, 'f, 'i, 'l)>
let combineLatest5: (
(
Rxjs.t<'a, 'b, 'c>,
Rxjs.t<'d, 'e, 'f>,
Rxjs.t<'g, 'h, 'i>,
Rxjs.t<'j, 'k, 'l>,
Rxjs.t<'m, 'n, 'o>,
),
) => Rxjs.t<Rxjs.foreign, Rxjs.void, ('c, 'f, 'i, 'l, 'o)>
`let combineLatest6: ( ( Rxjs.t<’a, ‘b, ‘c>, Rxjs.t<’d, ‘e, ‘f>, Rxjs.t<’g, ‘h, ‘i>, Rxjs.t<’j, ‘k, ‘l>, Rxjs.t<’m, ‘n, ‘o>, Rxjs.t<’p, ‘q, ‘r>, ), ) => Rxjs.t< Rxjs.foreign, Rxjs.void, (‘c, ‘f, ‘i, ‘l, ‘o, ‘r),
`
let map: (Rxjs.t<'a, 'b, 'c>, 'c => 'd) => Rxjs.t<'a, 'b, 'd>
let mapi: (Rxjs.t<'a, 'b, 'c>, ('c, int) => 'd) => Rxjs.t<'a, 'b, 'd>
let const: (Rxjs.t<'a, 'b, 'c>, 'd) => Rxjs.t<'a, 'b, 'd>
let bind: (
Rxjs.t<'ca, 'sa, 'out>,
'out => Rxjs.t<Rxjs.foreign, Rxjs.void, 'b>,
) => Rxjs.t<'ca, 'sa, 'b>
let merge: (
Rxjs.t<'ca, 'sa, 'a>,
'a => Rxjs.t<Rxjs.foreign, Rxjs.void, 'b>,
) => Rxjs.t<'ca, 'sa, 'b>
let switchMap: (
Rxjs.t<'ca, 'sa, 'a>,
'a => Rxjs.t<Rxjs.foreign, Rxjs.void, 'b>,
) => Rxjs.t<'ca, 'sa, 'b>
let switchSequence: Rxjs.t<'a, 'b, Rxjs.t<'c, 'd, 'e>> => Rxjs.t<'a, 'b, 'e>
let tap: (Rxjs.t<'a, 'b, 'c>, 'c => unit) => Rxjs.t<'a, 'b, 'c>
let tap_: (Rxjs.t<'a, 'b, 'c>, 'c => unit) => unit
let filter: (Rxjs.t<'a, 'b, 'c>, 'c => bool) => Rxjs.t<'a, 'b, 'c>
let finalize: (Rxjs.t<'a, 'b, 'c>, unit => unit) => Rxjs.t<'a, 'b, 'c>
let finally: (Rxjs.t<'a, 'b, 'c>, 'c => unit) => unit
let withLatestFrom: (
Rxjs.t<'a, 'b, 'c>,
Rxjs.t<'d, 'e, 'f>,
) => Rxjs.t<'a, 'b, ('c, 'f)>
let withLatestFrom2: (
Rxjs.t<'a, 'b, 'c>,
Rxjs.t<'d, 'e, 'f>,
Rxjs.t<'g, 'h, 'i>,
) => Rxjs.t<'a, 'b, ('c, 'f, 'i)>
let take: (Rxjs.t<'a, 'b, 'c>, int) => Rxjs.t<'a, 'b, 'c>
let keepMap: (Rxjs.t<'a, 'b, 'c>, 'c => option<'d>) => Rxjs.t<'a, 'b, 'd>
let contramap: (Rxjs.Observer.t<'a>, 'b => 'a) => Rxjs.Observer.t<'b>
let contrafilter: (
Rxjs.Observer.t<'a>,
'b => option<'a>,
) => Rxjs.Observer.t<'b>
let contraCatOptions: Rxjs.Observer.t<'a> => Rxjs.Observer.t<option<'a>>
let partition2: (
Rxjs.t<'a, 'b, 'c>,
('c => option<'d>, 'c => option<'e>),
) => (Rxjs.t<'a, 'b, 'd>, Rxjs.t<'a, 'b, 'e>)
let partition3: (
Rxjs.t<'a, 'b, 'c>,
('c => option<'d>, 'c => option<'e>, 'c => option<'f>),
) => (
Rxjs.t<'a, 'b, 'd>,
Rxjs.t<'a, 'b, 'e>,
Rxjs.t<'a, 'b, 'f>,
)
let partition4: (
Rxjs.t<'a, 'b, 'c>,
(
'c => option<'d>,
'c => option<'e>,
'c => option<'f>,
'c => option<'g>,
),
) => (
Rxjs.t<'a, 'b, 'd>,
Rxjs.t<'a, 'b, 'e>,
Rxjs.t<'a, 'b, 'f>,
Rxjs.t<'a, 'b, 'g>,
)
let partition5: (
Rxjs.t<'a, 'b, 'c>,
(
'c => option<'d>,
'c => option<'e>,
'c => option<'f>,
'c => option<'g>,
'c => option<'h>,
),
) => (
Rxjs.t<'a, 'b, 'd>,
Rxjs.t<'a, 'b, 'e>,
Rxjs.t<'a, 'b, 'f>,
Rxjs.t<'a, 'b, 'g>,
Rxjs.t<'a, 'b, 'h>,
)
let partition6: (
Rxjs.t<'a, 'b, 'c>,
(
'c => option<'d>,
'c => option<'e>,
'c => option<'f>,
'c => option<'g>,
'c => option<'h>,
'c => option<'i>,
),
) => (
Rxjs.t<'a, 'b, 'd>,
Rxjs.t<'a, 'b, 'e>,
Rxjs.t<'a, 'b, 'f>,
Rxjs.t<'a, 'b, 'g>,
Rxjs.t<'a, 'b, 'h>,
Rxjs.t<'a, 'b, 'i>,
)
let partition7: (
Rxjs.t<'a, 'b, 'c>,
(
'c => option<'d>,
'c => option<'e>,
'c => option<'f>,
'c => option<'g>,
'c => option<'h>,
'c => option<'i>,
'c => option<'j>,
),
) => (
Rxjs.t<'a, 'b, 'd>,
Rxjs.t<'a, 'b, 'e>,
Rxjs.t<'a, 'b, 'f>,
Rxjs.t<'a, 'b, 'g>,
Rxjs.t<'a, 'b, 'h>,
Rxjs.t<'a, 'b, 'i>,
Rxjs.t<'a, 'b, 'j>,
)
let finalizeWithValue: (
Rxjs.t<'c, 's, 'o>,
option<'o> => unit,
) => Rxjs.t<Rxjs.foreign, Rxjs.void, 'o>
let delay: Rxjs.t<'a, 'b, 'c> => Rxjs.t<'a, 'b, 'c>
let jitter: Rxjs.t<'a, 'b, 'c> => Rxjs.t<'a, 'b, 'c>
let _log: (
~enable: bool=?,
Rxjs.t<'a, 'b, 'c>,
'd,
) => Rxjs.t<'a, 'b, 'c>
let log: (
~enable: bool=?,
Rxjs.t<'a, 'b, 'c>,
'd,
) => Rxjs.t<'a, 'b, 'c>
let log_: (~enable: bool=?, Rxjs.t<'a, 'b, 'c>, 'd) => unit
let mapLog: (Rxjs.t<'a, 'b, 'c>, 'd, 'c => 'e) => Rxjs.t<'a, 'b, 'c>
This module type describes the requirements for a Field module
You’ll see this Field.T in the Module Functions which asserts
that a module passed to the function has each of these types and values.
type context
type input
let showInput: input => string
type output
type error
type inner
type t
let empty: context => inner
let init: context => t
let set: input => t
let validate: (bool, context, t) => Rxjs.t<Rxjs.foreign, Rxjs.void, t>
type actions<'change>
let mapActions: (actions<'change>, 'change => 'b) => actions<'b>
let makeDyn: (
context,
option<input>,
Rxjs.Observable.t<input>,
option<Rxjs.Observable.t<unit>>,
) => Dyn.t<Close.t<Form.t<t, actions<unit>>>>
let inner: t => inner
let input: t => input
let output: t => option<output>
let error: t => option<error>
let enum: t => Store.enum
let show: t => string
let printError: t => option<string>
let printErrorArray: Array.t<option<string>> => option<string>
`type structure<’output, ‘element, ‘empty> = { validate?: array<’output> => Prelude.Promise.t< Prelude.Result.t<unit, string>,
, element: ‘element, empty?: unit => array<’empty>, validateImmediate?: bool, }`
let length: (
~len: int,
Array.t<'a>,
) => Prelude.Promise.t<result<unit, string>>
type t
let filter: array<t> => array<t>
let filterIdentity: array<'a> => array<'a>
let filterGrace: array<'t> => Array.t<'t>
type actions<'finput, 'factions, 'out> = {
set: array<'finput> => 'out,
add: option<'finput> => 'out,
remove: int => 'out,
opt: option<array<'finput>> => 'out,
clear: unit => 'out,
reset: unit => 'out,
index: int => option<'factions>,
}
type context
type input
let showInput: input => string
type output
type error
type inner
type t
let empty: context => inner
let init: context => t
let set: input => t
let validate: (bool, context, t) => Rxjs.t<Rxjs.foreign, Rxjs.void, t>
type actions<'change>
let mapActions: (actions<'change>, 'change => 'b) => actions<'b>
let makeDyn: (
context,
option<input>,
Rxjs.Observable.t<input>,
option<Rxjs.Observable.t<unit>>,
) => Dyn.t<Close.t<Form.t<t, actions<unit>>>>
let inner: t => inner
let input: t => input
let output: t => option<output>
let error: t => option<error>
let enum: t => Store.enum
let show: t => string
let printError: t => option<string>
type inputElement
type parted
let split: Form.t<t, actions<unit>> => parted
type error = [#Part | #Whole(string)]
`type context = Context.structure< F.output, F.context, F.input,
`
type input = array<F.input>
let showInput: input => string
type output = array<F.output>
type error = error
type inner = array<F.t>
type t = Store.t<array<F.t>, array<F.output>, error>
let empty: context => inner
let init: context => t
let set: input => t
let validate: (bool, context, t) => Rxjs.t<Rxjs.foreign, Rxjs.void, t>
`type actions<’change> = actions< F.input, F.actions<’change>, ‘change,
`
let mapActions: (actions<'change>, 'change => 'b) => actions<'b>
let makeDyn: (
context,
option<input>,
Rxjs.Observable.t<input>,
option<Rxjs.Observable.t<unit>>,
) => Dyn.t<Close.t<Form.t<t, actions<unit>>>>
let inner: t => inner
let input: t => input
let output: t => option<output>
let error: t => option<error>
let enum: t => Store.enum
let show: t => string
let printError: t => option<string>
type inputElement = F.input
type parted = array<Form.t<F.t, F.actions<unit>>>
let split: Form.t<t, actions<unit>> => parted
type context = unit
type input = bool
let showInput: input => string
type output = bool
type error = unit
type inner = bool
type t = Store.t<inner, output, error>
let empty: 'a => bool
let init: 'a => Store.t<bool, 'b, 'c>
let set: 'a => Store.t<'a, 'a, 'b>
let validate: ('a, context, t) => Rxjs.t<Rxjs.foreign, Rxjs.void, t>
type actions<'change> = {set: input => 'change}
let mapActions: (actions<'a>, 'a => 'b) => actions<'b>
let makeDyn: (
context,
option<input>,
Rxjs.Observable.t<input>,
option<Rxjs.Observable.t<unit>>,
) => Dyn.t<Close.t<Form.t<t, actions<unit>>>>
let inner: Store.t<'a, 'b, 'c> => 'a
let input: Store.t<'a, 'b, 'c> => 'a
let output: Store.t<'a, 'b, 'c> => option<'b>
let error: Store.t<'a, 'b, 'c> => option<'c>
let enum: Store.t<'a, 'b, 'c> => Store.enum
let show: t => string
let printError: t => option<'a>
unhandled kind moduleAlias
Here as a touchpoint for copypaste
Explicitly typed as Field to force consistency with module type.
but you shouldnt need to do that if youre implementing your own.
unhandled kind moduleAlias unhandled kind moduleAlias unhandled kind moduleAlias unhandled kind moduleAlias
type error = [#Part | #Whole(string)]
`type resultValidate = Prelude.Promise.t< Prelude.Result.t<unit, string>,
`
type validateOut<'out> = 'out => resultValidate
type t<'e, 'v, 'i> = {
empty?: 'e,
validate?: 'v,
inner: 'i,
validateImmediate?: bool,
}
let empty: t<'a, 'b, 'c> => option<'a>
let validate: t<'a, 'b, 'c> => option<'b>
let inner: t<'a, 'b, 'c> => 'c
let trimap: (
'a => 'b,
'c => 'd,
'e => 'f,
t<'a, 'c, 'e>,
) => t<'b, 'd, 'f>
type t<'input, 'change, 'inner> = {
set: 'input => 'change,
clear: unit => 'change,
opt: option<'input> => 'change,
inner: 'inner,
validate: unit => 'change,
}
let trimap: (
t<'a, 'b, 'c>,
'd => 'a,
'b => 'e,
'c => 'f,
) => t<'d, 'e, 'f>
let const: ('a => 'b, 'a, 'c) => 'b
let outputresult: ('a => option<'b>, 'a => 'c, 'a) => result<'b, 'c>
`let resolveErr: ( ‘a, [< #Busy | #Dirty | #Init | #Invalid | #Valid], ) => Rxjs.t< Rxjs.foreign, Rxjs.void, Store.t<’a, ‘b, [> #Part]>,
`
type contextInner
type context
type input
type t
type inner
type output
let showInput: input => string
let inner: t => inner
let set: input => t
let emptyInner: contextInner => inner
let empty: context => inner
let hasEnum: (inner, Store.enum) => bool
let toResultInner: inner => result<output, Store.enum>
let validateInner: (
contextInner,
inner,
) => Rxjs.t<Rxjs.foreign, Rxjs.void, inner>
type actionsInner<'change>
let mapActionsInner: (actionsInner<'change>, 'change => 'b) => actionsInner<'b>
type partition
partition is opaque here but will be a composition of Form.t
let splitInner: (inner, actionsInner<unit>) => partition
let makeDynInner: (
contextInner,
option<input>,
Rxjs.Observable.t<input>,
) => Dyn.t<Close.t<Form.t<inner, actionsInner<unit>>>>
let toInputInner: inner => input
let printErrorInner: inner => array<option<string>>
let showInner: inner => array<string>
type input = unit
type inner = unit
type output = unit
type error = error
type t = Store.t<inner, output, error>
type validate = validateOut<output>
type contextInner = unit
type context = unit
let inputInner: unit => unit
let toInputInner: unit => unit
let input: t => unit
let showInput: unit => string
let set: unit => t
let emptyInner: contextInner => inner
let empty: contextInner => inner
let initInner: unit => unit
let init: unit => Store.t<unit, unit, 'a>
let hasEnum: ('a, [> #Valid]) => bool
let toResultInner: unit => result<output, Store.enum>
let validateInner: ('a, inner) => Rxjs.t<Rxjs.foreign, Rxjs.void, inner>
let validate: ('a, context, t) => Rxjs.t<Rxjs.foreign, Rxjs.void, t>
let inner: 'a => unit
let showInner: 'a => array<'b>
let enum: 'a => [> #Valid]
let output: 'a => unit
let error: 'a => option<'b>
let printErrorInner: inner => array<option<string>>
let printError: t => option<string>
let show: t => string
type actionsInner<'change> = unit
let mapActionsInner: ('a, 'b) => unit
`type actions<’change> = Actions.t< input, ‘change, actionsInner<’change>,
`
let mapActions: (Actions.t<'a, 'b, 'c>, 'c => 'd) => Actions.t<'a, unit, 'd>
type partition = unit
let splitInner: ('a, 'b) => unit
let makeDynInner: (
contextInner,
option<input>,
Rxjs.Observable.t<input>,
) => Dyn.t<Close.t<Form.t<inner, actionsInner<unit>>>>
let makeDyn: (
context,
option<input>,
Rxjs.Observable.t<input>,
option<Rxjs.Observable.t<unit>>,
) => Dyn.t<Close.t<Form.t<t, actions<unit>>>>
type input = (Head.input, Tail.input)
type inner = (Head.t, Tail.inner)
type output = (Head.output, Tail.output)
type error = error
type validate = validateOut<output>
type contextInner = (Head.context, Tail.contextInner)
type context = Context.t<input, validate, contextInner>
type t = Store.t<inner, output, error>
let showInput: input => string
let set: input => t
let emptyInner: contextInner => inner
let empty: context => inner
let init: context => Store.t<inner, 'a, 'b>
`let validateOut: ( ~validate: option<output => Js.Promise.t<result<’a, ‘b»>, ~immediate: bool=?, inner, output, ) => Rxjs.t< Rxjs.foreign, Rxjs.void, Store.t<inner, output, [> #Whole(‘b)]>,
`
let hasEnum: ((Head.t, Tail.inner), Store.enum) => bool
`let allResult: ( ( Prelude.Result.t<Head.output, Store.enum>, Prelude.Result.t<Tail.output, Store.enum>, ), ) => Prelude.Result.t< (Head.output, Tail.output), Store.enum,
`
let toResultInner: inner => result<output, Store.enum>
`let makeStore: ( ~validate: (inner, output) => Rxjs.t< Rxjs.foreign, Rxjs.void, t,
, inner, ) => Rxjs.t<Rxjs.foreign, Rxjs.void, t>`
let validateInner: (
contextInner,
inner,
) => Rxjs.t<Rxjs.foreign, Rxjs.void, inner>
let validateImpl: (context, t) => Rxjs.t<Rxjs.foreign, Rxjs.void, t>
let validate: (bool, context, t) => Rxjs.t<Rxjs.foreign, Rxjs.void, t>
type actionsInner<'change> = (
Head.actions<'change>,
Tail.actionsInner<'change>,
)
let mapActionsInner: (
(Head.actions<'a>, Tail.actionsInner<'a>),
'a => 'b,
) => (Head.actions<'b>, Tail.actionsInner<'b>)
`type actions<’change> = Actions.t< input, ‘change, actionsInner<’change>,
`
`let mapActions: ( Actions.t< ‘a, ‘b, (Head.actions<’b>, Tail.actionsInner<’b>),
, ‘b => ‘c, ) => Actions.t< ‘a, ‘c, (Head.actions<’c>, Tail.actionsInner<’c>), `
type partition = (
Form.t<Head.t, Head.actions<unit>>,
Tail.partition,
)
let splitInner: (inner, actionsInner<unit>) => partition
let split: Form.t<t, actions<unit>> => partition
`let logField: Rxjs.t< ‘b, ‘c, Rxjs.t<’d, ‘e, Close.t<Form.t<’t, ‘a»>,
=> Rxjs.t<’b, ‘c, Rxjs.t<’d, ‘e, Close.t<Form.t<’t, ‘a»»`
let makeDynInner: (
contextInner,
option<input>,
Rxjs.Observable.t<input>,
) => Dyn.t<Close.t<Form.t<inner, actionsInner<unit>>>>
let makeDyn: (
context,
option<input>,
Rxjs.Observable.t<input>,
option<Rxjs.Observable.t<unit>>,
) => Dyn.t<Close.t<Form.t<t, actions<unit>>>>
let toInputInner: inner => (Head.input, Tail.input)
let input: t => (Head.input, Tail.input)
let inner: Store.t<'a, 'b, 'c> => 'a
let output: Store.t<'a, 'b, 'c> => option<'b>
let error: Store.t<'a, 'b, 'c> => option<'c>
let enum: Store.t<'a, 'b, 'c> => Store.enum
let printErrorInner: inner => Array.t<option<string>>
let printError: t => option<string>
let showInner: inner => Array.t<string>
let show: t => string
unhandled kind moduleAlias
In traversing a field tree, it gets painful to manage adjusting your field type and the change nesting in parallel.
but we know enough in fields to do that parallel partition for you.
this type then contains a field and actions appropriate for one level in the tree.
onChange also included in cases where you have a change directly at the level of this field
and havnt yet or cant convert to actions. I go back and forth about functionalalizing. but the deeply nested change typese
were hard for people to reason about….
type t<'f, 'actions> = {field: 'f, actions: 'actions}
let field: t<'f, 'actions> => 'f
let actions: t<'f, 'actions> => 'actions
let bimap: (t<'a, 'b>, 'a => 'c, 'b => 'd) => t<'c, 'd>
type enum = [#Busy | #Dirty | #Init | #Invalid | #Valid]
let enumToPretty: enum => string
let enumToA: enum => Prelude.String.t
type t<'inner, 'output, 'error> =
| Init('inner)
| Dirty('inner)
| Busy('inner)
| Invalid('inner, 'error)
| Valid('inner, 'output)
let init: 'inner => t<'inner, 'output, 'error>
let dirty: 'inner => t<'inner, 'output, 'error>
let busy: 'inner => t<'inner, 'output, 'error>
let invalid: ('inner, 'error) => t<'inner, 'output, 'error>
let valid: ('inner, 'output) => t<'inner, 'output, 'error>
let toEnum: t<'i, 'o, 'e> => enum
let inner: t<'i, 'o, 'e> => 'i
let mapInner: (t<'i, 'o, 'e>, 'i => 'ib) => t<'ib, 'o, 'e>
let bimap: (t<'i, 'o, 'e>, 'i => 'ib, 'o => 'ob) => t<'ib, 'ob, 'e>
let output: t<'i, 'o, 'e> => option<'o>
let mapOutput: (t<'a, 'b, 'c>, 'b => 'd) => t<'a, 'd, 'c>
let error: t<'i, 'o, 'e> => option<'e>
type ret = Form.t<F.t, F.actions<unit>>
let use: (
~context: F.context,
~init: option<F.input>,
~validateInit: 'a,
) => ret