Flatten
Constructors
Mapping
Model
AlreadyFlat interface
Added in v1.0.0
Source
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
Added in v1.0.0
Source
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
Added in v1.0.0
Source
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
Added in v1.0.0
Source
Returns true if the specified Flatten is a Flattened, false otherwise.
Signature
declare const isFlattened: <A>(a: Flatten<A>) => a is Flattened<A>;isNeverFlat
Added in v1.0.0
Source
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
Added in v1.0.0
Source
Signature
declare const FlattenTypeId: unique symbol;FlattenTypeId type
Added in v1.0.0
Source
Signature
type FlattenTypeId = typeof FlattenTypeId;
Represents a
FlattenResultwhere the input was already flat.