Flatten
Constructors
Mapping
Model
AlreadyFlat interface
Represents a FlattenResult where the input was already flat.
Signature
interface AlreadyFlat<A> extends Variance<A> { readonly _tag: "AlreadyFlat";}Because certain documents do not change after removal of newlines, etc, there
is no point in creating a Union of the flattened and unflattened versions.
All this leads to is the introduction of two possible branches for a layout
algorithm to take, resulting in potentially exponential behavior on deeply
nested examples.
Signature
type Flatten<A> = Flattened<A> | AlreadyFlat<A> | NeverFlat<A>Represents a FlattenResult where A is likely flatter than the input.
Signature
interface Flattened<A> extends Variance<A> { readonly _tag: "Flattened"; readonly value: A;}FlattenTypeLambda interface
Signature
interface FlattenTypeLambda extends TypeLambda { readonly type: Flatten<unknown>;}Represents a FlattenResult where the input cannot be flattened.
Signature
interface NeverFlat<A> extends Variance<A> { readonly _tag: "NeverFlat";}Other
Refinements
isAlreadyFlat
Returns true if the specified Flatten is an AlreadyFlat, false otherwise.
Signature
declare const isAlreadyFlat: <A>(a: Flatten<A>) => a is AlreadyFlat<A>Returns true if the specified value is a Flatten, false otherwise.
Signature
declare const isFlatten: (u: unknown) => u is Flatten<unknown>isFlattened
Returns true if the specified Flatten is a Flattened, false otherwise.
Signature
declare const isFlattened: <A>(a: Flatten<A>) => a is Flattened<A>isNeverFlat
Returns true if the specified Flatten is a NeverFlat, false otherwise.
Signature
declare const isNeverFlat: <A>(a: Flatten<A>) => a is NeverFlat<A>Symbol
FlattenTypeId
Signature
declare const FlattenTypeId: unique symbolFlattenTypeId type
Signature
type FlattenTypeId = typeof FlattenTypeId