/**
* @since 1.0.0
*/
import type * as covariant from "@effect/typeclass/Covariant";
import type * as invariant from "@effect/typeclass/Invariant";
import type * as monoid from "@effect/typeclass/Monoid";
import type { Equal } from "effect/Equal";
import type { TypeLambda } from "effect/HKT";
import type { Option } from "effect/Option";
/**
* @since 1.0.0
* @category symbol
*/
export declare const DocStreamTypeId: unique symbol;
/**
* @since 1.0.0
* @category symbol
*/
export type DocStreamTypeId = typeof DocStreamTypeId;
/**
* Represents a document that has been laid out and can be processed used by the
* rendering algorithms.
*
* A simplified view is that a `Doc` is equivalent to an array of `DocStream`,
* and the layout algorithms simply pick a `DocStream` based upon which instance
* best fits the layout constraints. Therefore, a `DocStream` has all complexity
* contained in a `Doc` resolved, making it very easy to convert to other
* formats, such as plaintext or terminal output.
*
* @since 1.0.0
* @category model
*/
export type DocStream = FailedStream | EmptyStream | CharStream | TextStream | LineStream | PushAnnotationStream | PopAnnotationStream;
/**
* @since 1.0.0
*/
export declare namespace DocStream {
/**
* @since 1.0.0
* @category model
*/
interface Variance extends Equal {
readonly [DocStreamTypeId]: {
readonly _A: (_: never) => A;
};
}
/**
* @since 1.0.0
* @category model
*/
type TypeLambda = DocStreamTypeLambda;
}
/**
* @since 1.0.0
* @category model
*/
export interface DocStreamTypeLambda extends TypeLambda {
readonly type: DocStream;
}
/**
* Represents a `Doc` that failed to be laid out.
*
* @since 1.0.0
* @category model
*/
export interface FailedStream extends DocStream.Variance {
readonly _tag: "FailedStream";
}
/**
* Represents the an empty `Doc`.
*
* @since 1.0.0
* @category model
*/
export interface EmptyStream extends DocStream.Variance {
readonly _tag: "EmptyStream";
}
/**
* Represents a `Doc` containing a single character.
*
* @since 1.0.0
* @category model
*/
export interface CharStream extends DocStream.Variance {
readonly _tag: "CharStream";
readonly char: string;
readonly stream: DocStream;
}
/**
* Represents a `Doc` containing a string of text.
*
* @since 1.0.0
* @category model
*/
export interface TextStream extends DocStream.Variance {
readonly _tag: "TextStream";
readonly text: string;
readonly stream: DocStream;
}
/**
* Represents a `Doc` containing a single line. The `indentation`
* represents the indentation level for the subsequent line in the
* `Doc`.
*
* @since 1.0.0
* @category model
*/
export interface LineStream extends DocStream.Variance {
readonly _tag: "LineStream";
readonly indentation: number;
readonly stream: DocStream;
}
/**
* Represents the addition of an annotation of type `A` to a `Doc`.
*
* @since 1.0.0
* @category model
*/
export interface PushAnnotationStream extends DocStream.Variance {
readonly _tag: "PushAnnotationStream";
readonly annotation: A;
readonly stream: DocStream;
}
/**
* Represents the removal of a previously pushed annotation from a `Doc`.
*
* @since 1.0.0
* @category model
*/
export interface PopAnnotationStream extends DocStream.Variance {
readonly _tag: "PopAnnotationStream";
readonly stream: DocStream;
}
/**
* Returns `true` if the specified value is a `DocStream`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
*/
export declare const isDocStream: (u: unknown) => u is DocStream;
/**
* Returns `true` if the specified `DocStream` is a `FailedStream`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
*/
export declare const isFailedStream: (self: DocStream) => self is FailedStream;
/**
* Returns `true` if the specified `DocStream` is a `EmptyStream`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
*/
export declare const isEmptyStream: (self: DocStream) => self is EmptyStream;
/**
* Returns `true` if the specified `DocStream` is a `CharStream`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
*/
export declare const isCharStream: (self: DocStream) => self is CharStream;
/**
* Returns `true` if the specified `DocStream` is a `TextStream`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
*/
export declare const isTextStream: (self: DocStream) => self is TextStream;
/**
* Returns `true` if the specified `DocStream` is a `LineStream`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
*/
export declare const isLineStream: (self: DocStream) => self is LineStream;
/**
* Returns `true` if the specified `DocStream` is a `PushAnnotationStream`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
*/
export declare const isPushAnnotationStream: (self: DocStream) => self is PushAnnotationStream;
/**
* Returns `true` if the specified `DocStream` is a `PopAnnotationStream`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
*/
export declare const isPopAnnotationStream: (self: DocStream) => self is PopAnnotationStream;
/**
* @since 1.0.0
* @category constructors
*/
export declare const failed: DocStream;
/**
* @since 1.0.0
* @category constructors
*/
export declare const empty: DocStream;
/**
* @since 1.0.0
* @category constructors
*/
export declare const char: {
/**
* @since 1.0.0
* @category constructors
*/
(char: string): (self: DocStream) => DocStream;
/**
* @since 1.0.0
* @category constructors
*/
(self: DocStream, char: string): DocStream;
};
/**
* @since 1.0.0
* @category constructors
*/
export declare const text: {
/**
* @since 1.0.0
* @category constructors
*/
(text: string): (self: DocStream) => DocStream;
/**
* @since 1.0.0
* @category constructors
*/
(self: DocStream, text: string): DocStream;
};
/**
* @since 1.0.0
* @category constructors
*/
export declare const line: {
/**
* @since 1.0.0
* @category constructors
*/
(indentation: number): (self: DocStream) => DocStream;
/**
* @since 1.0.0
* @category constructors
*/
(self: DocStream, indentation: number): DocStream;
};
/**
* @since 1.0.0
* @category constructors
*/
export declare const pushAnnotation: {
/**
* @since 1.0.0
* @category constructors
*/
(annotation: B): (self: DocStream) => DocStream;
/**
* @since 1.0.0
* @category constructors
*/
(self: DocStream, annotation: B): DocStream;
};
/**
* @since 1.0.0
* @category constructors
*/
export declare const popAnnotation: (stream: DocStream) => DocStream;
/**
* Changes the annotation of a document to a different annotation, or to
* none at all.
*
* @since 1.0.0
* @category annotations
*/
export declare const alterAnnotations: {
/**
* Changes the annotation of a document to a different annotation, or to
* none at all.
*
* @since 1.0.0
* @category annotations
*/
(f: (a: A) => Option): (self: DocStream) => DocStream;
/**
* Changes the annotation of a document to a different annotation, or to
* none at all.
*
* @since 1.0.0
* @category annotations
*/
(self: DocStream, f: (a: A) => Option): DocStream;
};
/**
* Modify the annotations of a document.
*
* @since 1.0.0
* @category annotations
*/
export declare const reAnnotate: {
/**
* Modify the annotations of a document.
*
* @since 1.0.0
* @category annotations
*/
(f: (a: A) => B): (self: DocStream) => DocStream;
/**
* Modify the annotations of a document.
*
* @since 1.0.0
* @category annotations
*/
(self: DocStream, f: (a: A) => B): DocStream;
};
/**
* Remove all annotations from a document.
*
* @since 1.0.0
* @category annotations
*/
export declare const unAnnotate: (self: DocStream) => DocStream;
/**
* @since 1.0.0
* @category folding
*/
export declare const foldMap: {
/**
* @since 1.0.0
* @category folding
*/
(M: monoid.Monoid, f: (a: A) => M): (self: DocStream) => M;
/**
* @since 1.0.0
* @category folding
*/
(self: DocStream, M: monoid.Monoid, f: (a: A) => M): M;
};
/**
* @since 1.0.0
* @category folding
*/
export declare const match: {
/**
* @since 1.0.0
* @category folding
*/
(patterns: {
readonly FailedStream: () => R;
readonly EmptyStream: () => R;
readonly CharStream: (char: string, stream: DocStream) => R;
readonly TextStream: (text: string, stream: DocStream) => R;
readonly LineStream: (indentation: number, stream: DocStream) => R;
readonly PushAnnotationStream: (annotation: A, stream: DocStream) => R;
readonly PopAnnotationStream: (stream: DocStream) => R;
}): (self: DocStream) => R;
/**
* @since 1.0.0
* @category folding
*/
(self: DocStream, patterns: {
readonly FailedStream: () => R;
readonly EmptyStream: () => R;
readonly CharStream: (char: string, stream: DocStream) => R;
readonly TextStream: (text: string, stream: DocStream) => R;
readonly LineStream: (indentation: number, stream: DocStream) => R;
readonly PushAnnotationStream: (annotation: A, stream: DocStream) => R;
readonly PopAnnotationStream: (stream: DocStream) => R;
}): R;
};
/**
* @since 1.0.0
* @category mapping
*/
export declare const map: {
/**
* @since 1.0.0
* @category mapping
*/
(f: (a: A) => B): (self: DocStream) => DocStream;
/**
* @since 1.0.0
* @category mapping
*/
(self: DocStream, f: (a: A) => B): DocStream;
};
/**
* @since 1.0.0
* @category instances
*/
export declare const Functor: covariant.Covariant;
/**
* @since 1.0.0
* @category instances
*/
export declare const Invariant: invariant.Invariant;
//# sourceMappingURL=DocStream.d.ts.map