Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@effect/printer

Package Overview
Dependencies
Maintainers
3
Versions
214
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@effect/printer - npm Package Compare versions

Comparing version 0.1.11 to 0.2.0

internal_effect_untraced/doc.d.ts

2540

Doc.d.ts

@@ -19,15 +19,20 @@ /**

*/
import { PageWidth } from "@effect/printer/PageWidth";
import { Flatten } from "@effect/printer/Flatten";
import * as D from "@effect/printer/internal/Doc";
import type { TypeLambda } from "@fp-ts/core/HKT";
import type { Covariant as _Functor } from "@fp-ts/core/typeclass/Covariant";
import type { Monoid } from "@fp-ts/core/typeclass/Monoid";
import type { Semigroup } from "@fp-ts/core/typeclass/Semigroup";
declare const TypeId: unique symbol;
import type { Equal } from "@effect/data/Equal";
import type { TypeLambda } from "@effect/data/HKT";
import type * as covariant from "@effect/data/typeclass/Covariant";
import type * as invariant from "@effect/data/typeclass/Invariant";
import type { Monoid } from "@effect/data/typeclass/Monoid";
import type { Semigroup } from "@effect/data/typeclass/Semigroup";
import type { Flatten } from "@effect/printer/Flatten";
import type { PageWidth } from "@effect/printer/PageWidth";
/**
* @since 1.0.0
* @category symbol
*/
export declare const DocTypeId: unique symbol;
/**
* @since 1.0.0
* @category symbol
*/
export type TypeId = typeof TypeId;
export type DocTypeId = typeof DocTypeId;
/**

@@ -37,5 +42,4 @@ * Represents a prettified document that has been annotated with data of type

*
* @since 1.0.0
* @category model
* @since 1.0.0
* @tsplus type effect/printer/Doc
*/

@@ -47,20 +51,16 @@ export type Doc<A> = Fail<A> | Empty<A> | Char<A> | Text<A> | Line<A> | FlatAlt<A> | Cat<A> | Nest<A> | Union<A> | Column<A> | WithPageWidth<A> | Nesting<A> | Annotated<A>;

export declare namespace Doc {
/**
* @since 1.0.0
* @category model
*/
interface Variance<A> extends Equal {
readonly [DocTypeId]: {
readonly _A: () => A;
};
}
type TypeLambda = DocTypeLambda;
}
/**
* @category model
* @since 1.0.0
* @tsplus type effect/printer/Doc.Ops
*/
export interface DocOps {
$: DocAspects;
}
/**
* @category instances
* @since 1.0.0
*/
export declare const Doc: DocOps;
/**
* @category model
* @since 1.0.0
*/

@@ -71,20 +71,11 @@ export interface DocTypeLambda extends TypeLambda {

/**
* @category model
* @since 1.0.0
* @tsplus type effect/printer/Doc.Aspects
*/
export interface DocAspects {
}
/**
* Represents a document that cannot be rendered. Generally occurs when
* Represents a document that cannot be rendereinternal. Generally occurs when
* flattening a line. The layout algorithms will reject this document and choose
* a more suitable rendering.
*
* @since 1.0.0
* @category model
* @since 1.0.0
*/
export interface Fail<A> {
export interface Fail<A> extends Doc.Variance<A> {
readonly _tag: "Fail";
readonly _id: TypeId;
readonly _A: (_: never) => A;
}

@@ -96,9 +87,7 @@ /**

*
* @since 1.0.0
* @category model
* @since 1.0.0
*/
export interface Empty<A> {
export interface Empty<A> extends Doc.Variance<A> {
readonly _tag: "Empty";
readonly _id: TypeId;
readonly _A: (_: never) => A;
}

@@ -111,9 +100,7 @@ /**

*
* @since 1.0.0
* @category model
* @since 1.0.0
*/
export interface Char<A> {
export interface Char<A> extends Doc.Variance<A> {
readonly _tag: "Char";
readonly _id: TypeId;
readonly _A: (_: never) => A;
readonly char: string;

@@ -128,9 +115,7 @@ }

*
* @since 1.0.0
* @category model
* @since 1.0.0
*/
export interface Text<A> {
export interface Text<A> extends Doc.Variance<A> {
readonly _tag: "Text";
readonly _id: TypeId;
readonly _A: (_: never) => A;
readonly text: string;

@@ -141,9 +126,7 @@ }

*
* @since 1.0.0
* @category model
* @since 1.0.0
*/
export interface Line<A> {
export interface Line<A> extends Doc.Variance<A> {
readonly _tag: "Line";
readonly _id: TypeId;
readonly _A: (_: never) => A;
}

@@ -153,3 +136,3 @@ /**

* will choose the first document, but when flattened (via `group`) the second
* document will be preferred.
* document will be preferreinternal.
*

@@ -159,9 +142,7 @@ * The layout algorithms operate under the assumption that the first alternative

*
* @since 1.0.0
* @category model
* @since 1.0.0
*/
export interface FlatAlt<A> {
export interface FlatAlt<A> extends Doc.Variance<A> {
readonly _tag: "FlatAlt";
readonly _id: TypeId;
readonly _A: (_: never) => A;
readonly left: Doc<A>;

@@ -173,9 +154,7 @@ readonly right: Doc<A>;

*
* @since 1.0.0
* @category model
* @since 1.0.0
*/
export interface Cat<A> {
export interface Cat<A> extends Doc.Variance<A> {
readonly _tag: "Cat";
readonly _id: TypeId;
readonly _A: (_: never) => A;
readonly left: Doc<A>;

@@ -187,9 +166,7 @@ readonly right: Doc<A>;

*
* @since 1.0.0
* @category model
* @since 1.0.0
*/
export interface Nest<A> {
export interface Nest<A> extends Doc.Variance<A> {
readonly _tag: "Nest";
readonly _id: TypeId;
readonly _A: (_: never) => A;
readonly indent: number;

@@ -207,9 +184,7 @@ readonly doc: Doc<A>;

*
* @since 1.0.0
* @category model
* @since 1.0.0
*/
export interface Union<A> {
export interface Union<A> extends Doc.Variance<A> {
readonly _tag: "Union";
readonly _id: TypeId;
readonly _A: (_: never) => A;
readonly left: Doc<A>;

@@ -221,9 +196,7 @@ readonly right: Doc<A>;

*
* @since 1.0.0
* @category model
* @since 1.0.0
*/
export interface Column<A> {
export interface Column<A> extends Doc.Variance<A> {
readonly _tag: "Column";
readonly _id: TypeId;
readonly _A: (_: never) => A;
readonly react: (position: number) => Doc<A>;

@@ -234,9 +207,7 @@ }

*
* @since 1.0.0
* @category model
* @since 1.0.0
*/
export interface WithPageWidth<A> {
export interface WithPageWidth<A> extends Doc.Variance<A> {
readonly _tag: "WithPageWidth";
readonly _id: TypeId;
readonly _A: (_: never) => A;
readonly react: (pageWidth: PageWidth) => Doc<A>;

@@ -247,9 +218,7 @@ }

*
* @since 1.0.0
* @category model
* @since 1.0.0
*/
export interface WithPageWidth<A> {
export interface WithPageWidth<A> extends Doc.Variance<A> {
readonly _tag: "WithPageWidth";
readonly _id: TypeId;
readonly _A: (_: never) => A;
readonly react: (pageWidth: PageWidth) => Doc<A>;

@@ -260,9 +229,7 @@ }

*
* @since 1.0.0
* @category model
* @since 1.0.0
*/
export interface Nesting<A> {
export interface Nesting<A> extends Doc.Variance<A> {
readonly _tag: "Nesting";
readonly _id: TypeId;
readonly _A: (_: never) => A;
readonly react: (level: number) => Doc<A>;

@@ -273,9 +240,7 @@ }

*
* @since 1.0.0
* @category model
* @since 1.0.0
*/
export interface Annotated<A> {
export interface Annotated<A> extends Doc.Variance<A> {
readonly _tag: "Annotated";
readonly _id: TypeId;
readonly _A: (_: never) => A;
readonly annotation: A;

@@ -286,6 +251,5 @@ readonly doc: Doc<A>;

* Returns `true` if the specified value is a `Doc`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops isDoc
* @tsplus location "@effect/printer/Doc"
*/

@@ -295,7 +259,5 @@ export declare const isDoc: (u: unknown) => u is Doc<unknown>;

* Returns `true` if the specified `Doc` is a `Fail`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops isFail
* @tsplus fluent effect/printer/Doc isFail
* @tsplus location "@effect/printer/Doc"
*/

@@ -305,7 +267,5 @@ export declare const isFail: <A>(self: Doc<A>) => self is Fail<A>;

* Returns `true` if the specified `Doc` is an `Empty`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops isEmpty
* @tsplus fluent effect/printer/Doc isEmpty
* @tsplus location "@effect/printer/Doc"
*/

@@ -315,7 +275,5 @@ export declare const isEmpty: <A>(self: Doc<A>) => self is Empty<A>;

* Returns `true` if the specified `Doc` is a `Char`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops isChar
* @tsplus fluent effect/printer/Doc isChar
* @tsplus location "@effect/printer/Doc"
*/

@@ -325,7 +283,5 @@ export declare const isChar: <A>(self: Doc<A>) => self is Char<A>;

* Returns `true` if the specified `Doc` is a `Text`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops isText
* @tsplus fluent effect/printer/Doc isText
* @tsplus location "@effect/printer/Doc"
*/

@@ -335,7 +291,5 @@ export declare const isText: <A>(self: Doc<A>) => self is Text<A>;

* Returns `true` if the specified `Doc` is a `Line`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops isLine
* @tsplus fluent effect/printer/Doc isLine
* @tsplus location "@effect/printer/Doc"
*/

@@ -345,7 +299,5 @@ export declare const isLine: <A>(self: Doc<A>) => self is Line<A>;

* Returns `true` if the specified `Doc` is a `FlatAlt`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops isFlatAlt
* @tsplus fluent effect/printer/Doc isFlatAlt
* @tsplus location "@effect/printer/Doc"
*/

@@ -355,7 +307,5 @@ export declare const isFlatAlt: <A>(self: Doc<A>) => self is FlatAlt<A>;

* Returns `true` if the specified `Doc` is a `Cat`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops isCat
* @tsplus fluent effect/printer/Doc isCat
* @tsplus location "@effect/printer/Doc"
*/

@@ -365,7 +315,5 @@ export declare const isCat: <A>(self: Doc<A>) => self is Cat<A>;

* Returns `true` if the specified `Doc` is a `Nest`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops isNest
* @tsplus fluent effect/printer/Doc isNest
* @tsplus location "@effect/printer/Doc"
*/

@@ -375,7 +323,5 @@ export declare const isNest: <A>(self: Doc<A>) => self is Nest<A>;

* Returns `true` if the specified `Doc` is a `Union`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops isUnion
* @tsplus fluent effect/printer/Doc isUnion
* @tsplus location "@effect/printer/Doc"
*/

@@ -385,7 +331,5 @@ export declare const isUnion: <A>(self: Doc<A>) => self is Union<A>;

* Returns `true` if the specified `Doc` is a `Column`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops isColumn
* @tsplus fluent effect/printer/Doc isColumn
* @tsplus location "@effect/printer/Doc"
*/

@@ -395,16 +339,12 @@ export declare const isColumn: <A>(self: Doc<A>) => self is Column<A>;

* Returns `true` if the specified `Doc` is a `WithPageWidth`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops isWithPageWidth
* @tsplus fluent effect/printer/Doc isWithPageWidth
* @tsplus location "@effect/printer/Doc"
*/
export declare const isWithPageWidth: typeof D.isWithPageWidth;
export declare const isWithPageWidth: <A>(self: Doc<A>) => self is WithPageWidth<A>;
/**
* Returns `true` if the specified `Doc` is a `Nesting`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops isNesting
* @tsplus fluent effect/printer/Doc isNesting
* @tsplus location "@effect/printer/Doc"
*/

@@ -414,7 +354,5 @@ export declare const isNesting: <A>(self: Doc<A>) => self is Nesting<A>;

* Returns `true` if the specified `Doc` is a `Annotated`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops isAnnotated
* @tsplus fluent effect/printer/Doc isAnnotated
* @tsplus location "@effect/printer/Doc"
*/

@@ -427,6 +365,5 @@ export declare const isAnnotated: <A>(self: Doc<A>) => self is Annotated<A>;

* - Cannot be the newline (`"\n"`) character
*
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops char
* @tsplus location "@effect/printer/Doc"
*/

@@ -440,6 +377,5 @@ export declare const char: (char: string) => Doc<never>;

* - Text cannot contain a newline (`"\n"`) character
*
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops text
* @tsplus location "@effect/printer/Doc"
*/

@@ -452,6 +388,5 @@ export declare const text: (text: string) => Doc<never>;

* disregarded (i.e. not rendered) in the output document.
*
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops string
* @tsplus location "@effect/printer/Doc"
*/

@@ -466,36 +401,36 @@ export declare const string: (str: string) => Doc<never>;

* render an empty line of output.
* @example import * as Doc from "@effect/printer/Doc"
import * as Render from "@effect/printer/Render"
import * as String from "@fp-ts/data/String"
import * as assert from "assert"
const doc = Doc.vsep([
Doc.text("hello"),
Doc.parens(D.empty), // `parens` for visibility purposes only
Doc.text("world")
])
const expected = `|hello
|()
|world`
assert.strictEqual(
Render.renderPrettyDefault(doc),
String.stripMargin(expected)
)
*
* @example
* import * as Doc from "@effect/printer/Doc"
* import * as Render from "@effect/printer/Render"
* import * as String from "@effect/data/String"
* import * as assert from "assert"
*
* const doc = Doc.vsep([
* Doc.text("hello"),
* Doc.parens(internal.empty), // `parens` for visibility purposes only
* Doc.text("world")
* ])
*
* const expected = `|hello
* |()
* |world`
*
* assert.strictEqual(
* Render.renderPrettyDefault(doc),
* String.stripMargin(expected)
* )
*
* @since 1.0.0
* @category primitives
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops empty
* @tsplus location "@effect/printer/Doc"
*/
export declare const empty: Doc<never>;
/**
* The `fail` document is a document that cannot be rendered.
* The `fail` document is a document that cannot be rendereinternal.
*
* Generally occurs when flattening a line. The layout algorithms will reject
* this document and choose a more suitable rendering.
*
* @since 1.0.0
* @category primitives
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops fail
* @tsplus location "@effect/printer/Doc"
*/

@@ -507,27 +442,28 @@ export declare const fail: Doc<never>;

* undone by `group`.
* @example import * as Doc from "@effect/printer/Doc"
import * as Render from "@effect/printer/Render"
import * as String from "@fp-ts/data/String"
const doc: Doc.Doc<never> = Doc.hcat([
Doc.text("lorem ipsum"),
Doc.line,
Doc.text("dolor sit amet")
])
assert.strictEqual(
Render.prettyDefault(doc),
String.stripMargin(
`|lorem ipsum
|dolor sit amet`
)
)
assert.strictEqual(
Render.prettyDefault(Doc.group(doc)),
"lorem ipsum dolor sit amet"
)
*
* @example
* import * as Doc from "@effect/printer/Doc"
* import * as Render from "@effect/printer/Render"
* import * as String from "@effect/data/String"
*
* const doc: Doc.Doc<never> = Doc.hcat([
* Doc.text("lorem ipsum"),
* Doc.line,
* Doc.text("dolor sit amet")
* ])
*
* assert.strictEqual(
* Render.prettyDefault(doc),
* String.stripMargin(
* `|lorem ipsum
* |dolor sit amet`
* )
* )
* assert.strictEqual(
* Render.prettyDefault(Doc.group(doc)),
* "lorem ipsum dolor sit amet"
* )
*
* @since 1.0.0
* @category primitives
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops line
* @tsplus location "@effect/printer/Doc"
*/

@@ -538,27 +474,28 @@ export declare const line: Doc<never>;

* break is undone by `group` (instead of `space`).
* @example import * as Doc from "@effect/printer/Doc"
import * as Render from "@effect/printer/Render"
import * as String from "@fp-ts/data/String"
const doc: Doc.Doc<never> = Doc.hcat([
Doc.text("lorem ipsum"),
Doc.lineBreak,
Doc.text("dolor sit amet")
])
assert.strictEqual(
Render.prettyDefault(doc),
String.stripMargin(
`|lorem ipsum
|dolor sit amet`
)
)
assert.strictEqual(
Render.prettyDefault(Doc.group(doc)),
"lorem ipsumdolor sit amet"
)
*
* @example
* import * as Doc from "@effect/printer/Doc"
* import * as Render from "@effect/printer/Render"
* import * as String from "@effect/data/String"
*
* const doc: Doc.Doc<never> = Doc.hcat([
* Doc.text("lorem ipsum"),
* Doc.lineBreak,
* Doc.text("dolor sit amet")
* ])
*
* assert.strictEqual(
* Render.prettyDefault(doc),
* String.stripMargin(
* `|lorem ipsum
* |dolor sit amet`
* )
* )
* assert.strictEqual(
* Render.prettyDefault(Doc.group(doc)),
* "lorem ipsumdolor sit amet"
* )
*
* @since 1.0.0
* @category primitives
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops lineBreak
* @tsplus location "@effect/printer/Doc"
*/

@@ -569,31 +506,32 @@ export declare const lineBreak: Doc<never>;

* onto the page, otherwise it behaves like `line`.
* @example import * as Doc from "@effect/printer/Doc"
import * as Render from "@effect/printer/Render"
import * as String from "@fp-ts/data/String"
const doc: Doc.Doc<never> = Doc.hcat([
Doc.text("lorem ipsum"),
Doc.softLine,
Doc.text("dolor sit amet")
])
// Here we have enough space to put everything onto one line
assert.strictEqual(
Render.pretty(80)(doc),
"lorem ipsum dolor sit amet"
)
// If the page width is narrowed to `10`, the layout algorithm will
// introduce a line break
assert.strictEqual(
Render.pretty(10)(Doc.group(doc)),
String.stripMargin(
`|lorem ipsum
|dolor sit amet`
)
)
*
* @example
* import * as Doc from "@effect/printer/Doc"
* import * as Render from "@effect/printer/Render"
* import * as String from "@effect/data/String"
*
* const doc: Doc.Doc<never> = Doc.hcat([
* Doc.text("lorem ipsum"),
* Doc.softLine,
* Doc.text("dolor sit amet")
* ])
*
* // Here we have enough space to put everything onto one line
* assert.strictEqual(
* Render.pretty(80)(doc),
* "lorem ipsum dolor sit amet"
* )
*
* // If the page width is narrowed to `10`, the layout algorithm will
* // introduce a line break
* assert.strictEqual(
* Render.pretty(10)(Doc.group(doc)),
* String.stripMargin(
* `|lorem ipsum
* |dolor sit amet`
* )
* )
*
* @since 1.0.0
* @category primitives
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops softLine
* @tsplus location "@effect/printer/Doc"
*/

@@ -605,31 +543,32 @@ export declare const softLine: Doc<never>;

* `space`).
* @example import * as Doc from "@effect/printer/Doc"
import * as Render from "@effect/printer/Render"
import * as String from "@fp-ts/data/String"
const doc: Doc.Doc<never> = Doc.hcat([
Doc.text("ThisText"),
Doc.softLineBreak,
Doc.text("IsWayTooLong")
])
// With enough space, we get direct concatenation of documents:
assert.strictEqual(
Render.pretty(80)(doc),
"ThisTextIsWayTooLong"
)
// If the page width is narrowed to `10`, the layout algorithm will
// introduce a line break
assert.strictEqual(
Render.pretty(10)(Doc.group(doc)),
String.stripMargin(
`|ThisText
|IsWayTooLong`
)
)
*
* @example
* import * as Doc from "@effect/printer/Doc"
* import * as Render from "@effect/printer/Render"
* import * as String from "@effect/data/String"
*
* const doc: Doc.Doc<never> = Doc.hcat([
* Doc.text("ThisText"),
* Doc.softLineBreak,
* Doc.text("IsWayTooLong")
* ])
*
* // With enough space, we get direct concatenation of documents:
* assert.strictEqual(
* Render.pretty(80)(doc),
* "ThisTextIsWayTooLong"
* )
*
* // If the page width is narrowed to `10`, the layout algorithm will
* // introduce a line break
* assert.strictEqual(
* Render.pretty(10)(Doc.group(doc)),
* String.stripMargin(
* `|ThisText
* |IsWayTooLong`
* )
* )
*
* @since 1.0.0
* @category primitives
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops softLineBreak
* @tsplus location "@effect/printer/Doc"
*/

@@ -639,25 +578,26 @@ export declare const softLineBreak: Doc<never>;

* The `hardLine` document is always laid out as a line break, regardless of
* space or whether or not the document was `group`"ed.
* @example import * as Doc from "@effect/printer/Doc"
import * as Render from "@effect/printer/Render"
import * as String from "@fp-ts/data/String"
const doc: Doc.Doc<never> = Doc.hcat([
Doc.text("lorem ipsum"),
Doc.hardLine,
Doc.text("dolor sit amet")
])
// Even with enough space, a line break is introduced
assert.strictEqual(
Render.pretty(1000)(doc),
String.stripMargin(
`|lorem ipsum
|dolor sit amet`
)
)
* space or whether or not the document was `group`"einternal.
*
* @example
* import * as Doc from "@effect/printer/Doc"
* import * as Render from "@effect/printer/Render"
* import * as String from "@effect/data/String"
*
* const doc: Doc.Doc<never> = Doc.hcat([
* Doc.text("lorem ipsum"),
* Doc.hardLine,
* Doc.text("dolor sit amet")
* ])
*
* // Even with enough space, a line break is introduced
* assert.strictEqual(
* Render.pretty(1000)(doc),
* String.stripMargin(
* `|lorem ipsum
* |dolor sit amet`
* )
* )
*
* @since 1.0.0
* @category primitives
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops hardLine
* @tsplus location "@effect/printer/Doc"
*/

@@ -667,6 +607,5 @@ export declare const hardLine: Doc<never>;

* A document containing a single `\` character.
*
* @since 1.0.0
* @category primitives
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops backslash
* @tsplus location "@effect/printer/Doc"
*/

@@ -676,6 +615,5 @@ export declare const backslash: Doc<never>;

* A document containing a single `:` character.
*
* @since 1.0.0
* @category primitives
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops colon
* @tsplus location "@effect/printer/Doc"
*/

@@ -685,6 +623,5 @@ export declare const colon: Doc<never>;

* A document containing a single `,` character.
*
* @since 1.0.0
* @category primitives
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops comma
* @tsplus location "@effect/printer/Doc"
*/

@@ -694,6 +631,5 @@ export declare const comma: Doc<never>;

* A document containing a single `.` character.
*
* @since 1.0.0
* @category primitives
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops dot
* @tsplus location "@effect/printer/Doc"
*/

@@ -703,6 +639,5 @@ export declare const dot: Doc<never>;

* A document containing a single `"` character.
*
* @since 1.0.0
* @category primitives
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops dquote
* @tsplus location "@effect/printer/Doc"
*/

@@ -712,6 +647,5 @@ export declare const dquote: Doc<never>;

* A document containing a single `=` character.
*
* @since 1.0.0
* @category primitives
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops equalSign
* @tsplus location "@effect/printer/Doc"
*/

@@ -721,6 +655,5 @@ export declare const equalSign: Doc<never>;

* A document containing a single `<` character.
*
* @since 1.0.0
* @category primitives
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops langle
* @tsplus location "@effect/printer/Doc"
*/

@@ -730,6 +663,5 @@ export declare const langle: Doc<never>;

* A document containing a single `{` character.
*
* @since 1.0.0
* @category primitives
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops lbrace
* @tsplus location "@effect/printer/Doc"
*/

@@ -739,6 +671,5 @@ export declare const lbrace: Doc<never>;

* A document containing a single `[` character.
*
* @since 1.0.0
* @category primitives
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops lbracket
* @tsplus location "@effect/printer/Doc"
*/

@@ -748,6 +679,5 @@ export declare const lbracket: Doc<never>;

* A document containing a single `(` character.
*
* @since 1.0.0
* @category primitives
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops lparen
* @tsplus location "@effect/printer/Doc"
*/

@@ -757,6 +687,5 @@ export declare const lparen: Doc<never>;

* A document containing a single `>` character.
*
* @since 1.0.0
* @category primitives
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops rangle
* @tsplus location "@effect/printer/Doc"
*/

@@ -766,6 +695,5 @@ export declare const rangle: Doc<never>;

* A document containing a single `}` character.
*
* @since 1.0.0
* @category primitives
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops rbrace
* @tsplus location "@effect/printer/Doc"
*/

@@ -775,6 +703,5 @@ export declare const rbrace: Doc<never>;

* A document containing a single `]` character.
*
* @since 1.0.0
* @category primitives
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops rbracket
* @tsplus location "@effect/printer/Doc"
*/

@@ -784,6 +711,5 @@ export declare const rbracket: Doc<never>;

* A document containing a single `)` character.
*
* @since 1.0.0
* @category primitives
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops rparen
* @tsplus location "@effect/printer/Doc"
*/

@@ -793,6 +719,5 @@ export declare const rparen: Doc<never>;

* A document containing a single `;` character.
*
* @since 1.0.0
* @category primitives
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops semi
* @tsplus location "@effect/printer/Doc"
*/

@@ -802,6 +727,5 @@ export declare const semi: Doc<never>;

* A document containing a single `/` character.
*
* @since 1.0.0
* @category primitives
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops slash
* @tsplus location "@effect/printer/Doc"
*/

@@ -811,6 +735,5 @@ export declare const slash: Doc<never>;

* A document containing a single `"` character.
*
* @since 1.0.0
* @category primitives
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops squote
* @tsplus location "@effect/printer/Doc"
*/

@@ -820,6 +743,5 @@ export declare const squote: Doc<never>;

* A document containing a single ` ` character.
*
* @since 1.0.0
* @category primitives
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops space
* @tsplus location "@effect/printer/Doc"
*/

@@ -829,6 +751,5 @@ export declare const space: Doc<never>;

* A document containing a single `|` character.
*
* @since 1.0.0
* @category primitives
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops vbar
* @tsplus location "@effect/printer/Doc"
*/

@@ -838,8 +759,10 @@ export declare const vbar: Doc<never>;

* The `cat` combinator lays out two documents separated by nothing.
*
* @since 1.0.0
* @category concatenation
* @since 1.0.0
* @tsplus pipeable effect/printer/Doc cat
* @tsplus location "@effect/printer/Doc"
*/
export declare const cat: <B>(that: Doc<B>) => <A>(self: Doc<A>) => Doc<B | A>;
export declare const cat: {
<B>(that: Doc<B>): <A>(self: Doc<A>) => Doc<B | A>;
<A, B>(self: Doc<A>, that: Doc<B>): Doc<A | B>;
};
/**

@@ -850,30 +773,31 @@ * The `cats` combinator will attempt to lay out a collection of documents

* which always lays out documents beneath one another.
* @example import * as Doc from "@effect/printer/Doc"
import * as Render from "@effect/printer/Render"
import * as String from "@fp-ts/data/String"
const doc: Doc.Doc<never> = Doc.hsep([
Doc.text("Docs:"),
Doc.cats(Doc.words("lorem ipsum dolor"))
])
assert.strictEqual(
Render.prettyDefault(doc),
"Docs: loremipsumdolor"
)
// If the document exceeds the width of the page, the documents are rendered
// one above another
assert.strictEqual(
Render.pretty(10)(doc),
String.stripMargin(
`|Docs: lorem
|ipsum
|dolor`
)
)
*
* @example
* import * as Doc from "@effect/printer/Doc"
* import * as Render from "@effect/printer/Render"
* import * as String from "@effect/data/String"
*
* const doc: Doc.Doc<never> = Doc.hsep([
* Doc.text("Docs:"),
* Doc.cats(Doc.words("lorem ipsum dolor"))
* ])
*
* assert.strictEqual(
* Render.prettyDefault(doc),
* "Docs: loremipsumdolor"
* )
*
* // If the document exceeds the width of the page, the documents are rendered
* // one above another
* assert.strictEqual(
* Render.pretty(10)(doc),
* String.stripMargin(
* `|Docs: lorem
* |ipsum
* |dolor`
* )
* )
*
* @since 1.0.0
* @category concatenation
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops cats
* @tsplus location "@effect/printer/Doc"
*/

@@ -884,191 +808,211 @@ export declare const cats: <A>(docs: Iterable<Doc<A>>) => Doc<A>;

* document between them.
* @example import * as Doc from "@effect/printer/Doc"
import * as Render from "@effect/printer/Render"
import { pipe } from "@fp-ts/data/Function"
import * as String from "@fp-ts/data/String"
const doc: Doc.Doc<never> = pipe(
Doc.char("a"),
Doc.catWithLine(Doc.char("b"))
)
assert.strictEqual(
Render.prettyDefault(doc),
String.stripMargin(
`|a
|b`
)
)
*
* @example
* import * as Doc from "@effect/printer/Doc"
* import * as Render from "@effect/printer/Render"
* import { pipe } from "@effect/data/Function"
* import * as String from "@effect/data/String"
*
* const doc: Doc.Doc<never> = pipe(
* Doc.char("a"),
* Doc.catWithLine(Doc.char("b"))
* )
*
* assert.strictEqual(
* Render.prettyDefault(doc),
* String.stripMargin(
* `|a
* |b`
* )
* )
*
* @since 1.0.0
* @category concatenation
* @since 1.0.0
* @tsplus static effect/printer/Doc.Aspects catWithLine
* @tsplus pipeable effect/printer/Doc catWithLine
* @tsplus location "@effect/printer/Doc"
*/
export declare const catWithLine: <B>(that: Doc<B>) => <A>(self: Doc<A>) => Doc<A | B>;
export declare const catWithLine: {
<B>(that: Doc<B>): <A>(self: Doc<A>) => Doc<B | A>;
<A, B>(self: Doc<A>, that: Doc<B>): Doc<A | B>;
};
/**
* The `catWithLineBreak` combinator concatenates two documents by placing a
* `lineBreak` document between them.
* @example import * as Doc from "@effect/printer/Doc"
import * as Render from "@effect/printer/Render"
import { pipe } from "@fp-ts/data/Function"
import * as String from "@fp-ts/data/String"
const doc: Doc.Doc<never> = pipe(
Doc.char("a"),
Doc.catWithLineBreak(Doc.char("b"))
)
assert.strictEqual(
Render.prettyDefault(doc),
String.stripMargin(
`|a
|b`
)
)
assert.strictEqual(
Render.prettyDefault(Doc.group(doc)),
"ab"
)
*
* @example
* import * as Doc from "@effect/printer/Doc"
* import * as Render from "@effect/printer/Render"
* import { pipe } from "@effect/data/Function"
* import * as String from "@effect/data/String"
*
* const doc: Doc.Doc<never> = pipe(
* Doc.char("a"),
* Doc.catWithLineBreak(Doc.char("b"))
* )
*
* assert.strictEqual(
* Render.prettyDefault(doc),
* String.stripMargin(
* `|a
* |b`
* )
* )
*
* assert.strictEqual(
* Render.prettyDefault(Doc.group(doc)),
* "ab"
* )
*
* @since 1.0.0
* @category concatenation
* @since 1.0.0
* @tsplus static effect/printer/Doc.Aspects catWithLineBreak
* @tsplus pipeable effect/printer/Doc catWithLineBreak
* @tsplus location "@effect/printer/Doc"
*/
export declare const catWithLineBreak: <B>(that: Doc<B>) => <A>(self: Doc<A>) => Doc<A | B>;
export declare const catWithLineBreak: {
<B>(that: Doc<B>): <A>(self: Doc<A>) => Doc<B | A>;
<A, B>(self: Doc<A>, that: Doc<B>): Doc<A | B>;
};
/**
* The `catWithSoftLine` combinator concatenates two documents by placing a
* `softLine` document between them.
* @example import * as Doc from "@effect/printer/Doc"
import * as Render from "@effect/printer/Render"
import { pipe } from "@fp-ts/data/Function"
import * as String from "@fp-ts/data/String"
const doc: Doc.Doc<never> = pipe(
Doc.char("a"),
Doc.catWithSoftLine(Doc.char("b"))
)
assert.strictEqual(
Render.prettyDefault(doc),
"a b"
)
assert.strictEqual(
Render.pretty(1)(doc),
String.stripMargin(
`|a
|b`
)
)
*
* @example
* import * as Doc from "@effect/printer/Doc"
* import * as Render from "@effect/printer/Render"
* import { pipe } from "@effect/data/Function"
* import * as String from "@effect/data/String"
*
* const doc: Doc.Doc<never> = pipe(
* Doc.char("a"),
* Doc.catWithSoftLine(Doc.char("b"))
* )
*
* assert.strictEqual(
* Render.prettyDefault(doc),
* "a b"
* )
*
* assert.strictEqual(
* Render.pretty(1)(doc),
* String.stripMargin(
* `|a
* |b`
* )
* )
*
* @since 1.0.0
* @category concatenation
* @since 1.0.0
* @tsplus static effect/printer/Doc.Aspects catWithSoftLine
* @tsplus pipeable effect/printer/Doc catWithSoftLine
* @tsplus location "@effect/printer/Doc"
*/
export declare const catWithSoftLine: <B>(that: Doc<B>) => <A>(self: Doc<A>) => Doc<A | B>;
export declare const catWithSoftLine: {
<B>(that: Doc<B>): <A>(self: Doc<A>) => Doc<B | A>;
<A, B>(self: Doc<A>, that: Doc<B>): Doc<A | B>;
};
/**
* The `catWithSoftLineBreak` combinator concatenates two documents by
* placing a `softLineBreak` document between them.
* @example import * as Doc from "@effect/printer/Doc"
import * as Render from "@effect/printer/Render"
import { pipe } from "@fp-ts/data/Function"
import * as String from "@fp-ts/data/String"
const doc: Doc.Doc<never> = pipe(
Doc.char("a"),
Doc.catWithSoftLineBreak(Doc.char("b"))
)
assert.strictEqual(
Render.prettyDefault(doc),
"ab"
)
assert.strictEqual(
Render.pretty(1)(doc),
String.stripMargin(
`|a
|b`
)
)
*
* @example
* import * as Doc from "@effect/printer/Doc"
* import * as Render from "@effect/printer/Render"
* import { pipe } from "@effect/data/Function"
* import * as String from "@effect/data/String"
*
* const doc: Doc.Doc<never> = pipe(
* Doc.char("a"),
* Doc.catWithSoftLineBreak(Doc.char("b"))
* )
*
* assert.strictEqual(
* Render.prettyDefault(doc),
* "ab"
* )
*
* assert.strictEqual(
* Render.pretty(1)(doc),
* String.stripMargin(
* `|a
* |b`
* )
* )
*
* @since 1.0.0
* @category concatenation
* @since 1.0.0
* @tsplus static effect/printer/Doc.Aspects catWithSoftLineBreak
* @tsplus pipeable effect/printer/Doc catWithSoftLineBreak
* @tsplus location "@effect/printer/Doc"
*/
export declare const catWithSoftLineBreak: <B>(that: Doc<B>) => <A>(self: Doc<A>) => Doc<A | B>;
export declare const catWithSoftLineBreak: {
<B>(that: Doc<B>): <A>(self: Doc<A>) => Doc<B | A>;
<A, B>(self: Doc<A>, that: Doc<B>): Doc<A | B>;
};
/**
* The `catWithSpace` combinator concatenates two documents by placing a
* `space` document between them.
* @example import * as Doc from "@effect/printer/Doc"
import * as Render from "@effect/printer/Render"
import { pipe } from "@fp-ts/data/Function"
const doc: Doc.Doc<never> = pipe(
Doc.char("a"),
Doc.catWithSpace(Doc.char("b"))
)
assert.strictEqual(
Render.prettyDefault(doc),
"a b"
)
*
* @example
* import * as Doc from "@effect/printer/Doc"
* import * as Render from "@effect/printer/Render"
* import { pipe } from "@effect/data/Function"
*
* const doc: Doc.Doc<never> = pipe(
* Doc.char("a"),
* Doc.catWithSpace(Doc.char("b"))
* )
*
* assert.strictEqual(
* Render.prettyDefault(doc),
* "a b"
* )
*
* @since 1.0.0
* @category concatenation
* @since 1.0.0
* @tsplus static effect/printer/Doc.Aspects catWithSpace
* @tsplus pipeable effect/printer/Doc catWithSpace
* @tsplus location "@effect/printer/Doc"
*/
export declare const catWithSpace: <B>(that: Doc<B>) => <A>(self: Doc<A>) => Doc<A | B>;
export declare const catWithSpace: {
<B>(that: Doc<B>): <A>(self: Doc<A>) => Doc<B | A>;
<A, B>(self: Doc<A>, that: Doc<B>): Doc<A | B>;
};
/**
* The `concatWith` combinator concatenates all documents in a collection
* element-wise with the specified binary function.
* @example import * as Doc from "@effect/printer/Doc"
import * as Render from "@effect/printer/Render"
import { pipe } from "@fp-ts/data/Function"
const doc: Doc.Doc<never> = pipe(
[Doc.char("a"), Doc.char("b")],
Doc.concatWith((x, y) => Doc.catWithSpace(y)(x))
)
assert.strictEqual(
Render.prettyDefault(doc),
"a b"
)
*
* @example
* import * as Doc from "@effect/printer/Doc"
* import * as Render from "@effect/printer/Render"
* import { pipe } from "@effect/data/Function"
*
* const doc: Doc.Doc<never> = pipe(
* [Doc.char("a"), Doc.char("b")],
* Doc.concatWith((x, y) => Doc.catWithSpace(y)(x))
* )
*
* assert.strictEqual(
* Render.prettyDefault(doc),
* "a b"
* )
*
* @since 1.0.0
* @category concatenation
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops concatWith
* @tsplus location "@effect/printer/Doc"
*/
export declare const concatWith: <A>(f: (x: Doc<A>, y: Doc<A>) => Doc<A>) => (docs: Iterable<Doc<A>>) => Doc<A>;
export declare const concatWith: {
<A>(f: (left: Doc<A>, right: Doc<A>) => Doc<A>): (docs: Iterable<Doc<A>>) => Doc<A>;
<A>(docs: Iterable<Doc<A>>, f: (left: Doc<A>, right: Doc<A>) => Doc<A>): Doc<A>;
};
/**
* The `vcat` combinator concatenates all documents in a collection vertically.
* If the output is grouped then the line breaks are removed.
* If the output is grouped then the line breaks are removeinternal.
*
* In other words `vcat` is like `vsep`, with newlines removed instead of
* replaced by spaces.
* @example import * as Doc from "@effect/printer/Doc"
import * as Render from "@effect/printer/Render"
import * as String from "@fp-ts/data/String"
const doc: Doc.Doc<never> = Doc.vcat(Doc.words("lorem ipsum dolor"))
assert.strictEqual(
Render.prettyDefault(doc),
String.stripMargin(
`|lorem
|ipsum
|dolor`
)
)
*
* @example
* import * as Doc from "@effect/printer/Doc"
* import * as Render from "@effect/printer/Render"
* import * as String from "@effect/data/String"
*
* const doc: Doc.Doc<never> = Doc.vcat(Doc.words("lorem ipsum dolor"))
*
* assert.strictEqual(
* Render.prettyDefault(doc),
* String.stripMargin(
* `|lorem
* |ipsum
* |dolor`
* )
* )
*
* @since 1.0.0
* @category concatenation
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops vcat
* @tsplus location "@effect/printer/Doc"
*/

@@ -1079,15 +1023,16 @@ export declare const vcat: <A>(docs: Iterable<Doc<A>>) => Doc<A>;

* without any spacing.
* @example import * as Render from "@effect/printer/Render"
import * as String from "@fp-ts/data/String"
const doc: Doc.Doc<never> = Doc.hcat(Doc.words("lorem ipsum dolor"))
assert.strictEqual(
Render.prettyDefault(doc),
"loremipsumdolor"
)
*
* @example
* import * as Render from "@effect/printer/Render"
* import * as String from "@effect/data/String"
*
* const doc: Doc.Doc<never> = Doc.hcat(Doc.words("lorem ipsum dolor"))
*
* assert.strictEqual(
* Render.prettyDefault(doc),
* "loremipsumdolor"
* )
*
* @since 1.0.0
* @category concatenation
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops hcat
* @tsplus location "@effect/printer/Doc"
*/

@@ -1103,7 +1048,6 @@ export declare const hcat: <A>(docs: Iterable<Doc<A>>) => Doc<A>;

* be separated with `empty` instead of newlines. See `fillSep` if you want a
* `space` instead.
* `space` insteainternal.
*
* @since 1.0.0
* @category concatenation
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops fillCat
* @tsplus location "@effect/printer/Doc"
*/

@@ -1116,22 +1060,23 @@ export declare const fillCat: <A>(docs: Iterable<Doc<A>>) => Doc<A>;

* For automatic line breaks, consider using `fillSep`.
* @example import * as Doc from "@effect/printer/Doc"
import * as Render from "@effect/printer/Render"
const doc: Doc.Doc<never> = Doc.hsep(Doc.words("lorem ipsum dolor sit amet"))
assert.strictEqual(
Render.pretty(80)(doc),
"lorem ipsum dolor sit amet"
)
// The `hsep` combinator will not introduce line breaks on its own, even when
// the page is too narrow
assert.strictEqual(
Render.pretty(5)(doc),
"lorem ipsum dolor sit amet"
)
*
* @example
* import * as Doc from "@effect/printer/Doc"
* import * as Render from "@effect/printer/Render"
*
* const doc: Doc.Doc<never> = Doc.hsep(Doc.words("lorem ipsum dolor sit amet"))
*
* assert.strictEqual(
* Render.pretty(80)(doc),
* "lorem ipsum dolor sit amet"
* )
*
* // The `hsep` combinator will not introduce line breaks on its own, even when
* // the page is too narrow
* assert.strictEqual(
* Render.pretty(5)(doc),
* "lorem ipsum dolor sit amet"
* )
*
* @since 1.0.0
* @category separation
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops hsep
* @tsplus location "@effect/printer/Doc"
*/

@@ -1142,3 +1087,3 @@ export declare const hsep: <A>(docs: Iterable<Doc<A>>) => Doc<A>;

* If a `group` undoes the line breaks inserted by `vsep`, the documents are
* separated with a space instead.
* separated with a space insteainternal.
*

@@ -1148,41 +1093,42 @@ * When a `vsep` is `group`ed, the documents are separated with a `space` if the

* function for this use case.
* @example import * as Doc from "@effect/printer/Doc"
import * as Render from "@effect/printer/Render"
import * as String from "@fp-ts/data/String"
const unaligned = Doc.hsep([
Doc.text("prefix"),
Doc.vsep(Doc.words("text to lay out"))
])
assert.strictEqual(
Render.prettyDefault(unaligned),
String.stripMargin(
`|prefix text
|to
|lay
|out`
)
)
// The `align` function can be used to align the documents under their first
// element
const aligned = Doc.hsep([
Doc.text("prefix"),
Doc.align(Doc.vsep(Doc.words("text to lay out")))
])
assert.strictEqual(
Render.prettyDefault(aligned),
String.stripMargin(
`|prefix text
| to
| lay
| out`
)
)
*
* @example
* import * as Doc from "@effect/printer/Doc"
* import * as Render from "@effect/printer/Render"
* import * as String from "@effect/data/String"
*
* const unaligned = Doc.hsep([
* Doc.text("prefix"),
* Doc.vsep(Doc.words("text to lay out"))
* ])
*
* assert.strictEqual(
* Render.prettyDefault(unaligned),
* String.stripMargin(
* `|prefix text
* |to
* |lay
* |out`
* )
* )
*
* // The `align` function can be used to align the documents under their first
* // element
* const aligned = Doc.hsep([
* Doc.text("prefix"),
* Doc.align(Doc.vsep(Doc.words("text to lay out")))
* ])
*
* assert.strictEqual(
* Render.prettyDefault(aligned),
* String.stripMargin(
* `|prefix text
* | to
* | lay
* | out`
* )
* )
*
* @since 1.0.0
* @category separation
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops vsep
* @tsplus location "@effect/printer/Doc"
*/

@@ -1199,6 +1145,5 @@ export declare const vsep: <A>(docs: Iterable<Doc<A>>) => Doc<A>;

* want a `space`.
*
* @since 1.0.0
* @category separation
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops fillSep
* @tsplus location "@effect/printer/Doc"
*/

@@ -1211,30 +1156,31 @@ export declare const fillSep: <A>(docs: Iterable<Doc<A>>) => Doc<A>;

* `vsep`, which always lays out documents beneath one another.
* @example import * as Doc from "@effect/printer/Doc"
import * as Render from "@effect/printer/Render"
import * as String from "@fp-ts/data/String"
const doc: Doc.Doc<never> = Doc.hsep([
Doc.text("prefix"),
Doc.seps(Doc.words("text to lay out"))
])
assert.strictEqual(
Render.prettyDefault(doc),
"prefix text to lay out"
)
// If the page width is too narrow, documents are separated by newlines
assert.strictEqual(
Render.pretty(20)(doc),
String.stripMargin(
`|prefix text
|to
|lay
|out`
)
)
*
* @example
* import * as Doc from "@effect/printer/Doc"
* import * as Render from "@effect/printer/Render"
* import * as String from "@effect/data/String"
*
* const doc: Doc.Doc<never> = Doc.hsep([
* Doc.text("prefix"),
* Doc.seps(Doc.words("text to lay out"))
* ])
*
* assert.strictEqual(
* Render.prettyDefault(doc),
* "prefix text to lay out"
* )
*
* // If the page width is too narrow, documents are separated by newlines
* assert.strictEqual(
* Render.pretty(20)(doc),
* String.stripMargin(
* `|prefix text
* |to
* |lay
* |out`
* )
* )
*
* @since 1.0.0
* @category separation
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops seps
* @tsplus location "@effect/printer/Doc"
*/

@@ -1251,61 +1197,64 @@ export declare const seps: <A>(docs: Iterable<Doc<A>>) => Doc<A>;

* algorithms will fall back to an even wider layout.
* @example import * as Doc from "@effect/printer/Doc"
import * as Render from "@effect/printer/Render"
import { pipe } from "@fp-ts/data/Function"
import * as String from "@fp-ts/data/String"
const open = pipe(Doc.empty, Doc.flatAlt(Doc.text("{ ")))
const close = pipe(Doc.empty, Doc.flatAlt(Doc.text(" }")))
const separator = pipe(Doc.empty, Doc.flatAlt(Doc.text("; ")))
const prettyDo = <A>(documents: Array<Doc.Doc<A>>): Doc.Doc<A> => {
return pipe(
Doc.hsep([
Doc.text("do"),
pipe(
documents,
Doc.encloseSep(open, close, separator),
Doc.align
)
]),
Doc.group
)
}
const statements = [
Doc.text("name:_ <- getArgs"),
Doc.text("let greet = \"Hello, \" <> name"),
Doc.text("putStrLn greet")
]
// If it fits, then the content is put onto a single line with the `{;}` style
assert.strictEqual(
pipe(prettyDo(statements), Render.pretty(80)),
"do { name:_ <- getArgs; let greet = \"Hello, \" <> name; putStrLn greet }"
)
// When there is not enough space, the content is broken up onto multiple lines
assert.strictEqual(
pipe(prettyDo(statements), Render.pretty(10)),
String.stripMargin(
`|do name:_ <- getArgs
| let greet = "Hello, " <> name
| putStrLn greet`
)
)
*
* @example
* import * as Doc from "@effect/printer/Doc"
* import * as Render from "@effect/printer/Render"
* import { pipe } from "@effect/data/Function"
* import * as String from "@effect/data/String"
*
* const open = pipe(Doc.empty, Doc.flatAlt(Doc.text("{ ")))
* const close = pipe(Doc.empty, Doc.flatAlt(Doc.text(" }")))
* const separator = pipe(Doc.empty, Doc.flatAlt(Doc.text("; ")))
*
* const prettyDo = <A>(documents: Array<Doc.Doc<A>>): Doc.Doc<A> => {
* return pipe(
* Doc.hsep([
* Doc.text("do"),
* pipe(
* documents,
* Doc.encloseSep(open, close, separator),
* Doc.align
* )
* ]),
* Doc.group
* )
* }
*
* const statements = [
* Doc.text("name:_ <- getArgs"),
* Doc.text("let greet = \"Hello, \" <> name"),
* Doc.text("putStrLn greet")
* ]
*
* // If it fits, then the content is put onto a single line with the `{;}` style
* assert.strictEqual(
* pipe(prettyDo(statements), Render.pretty(80)),
* "do { name:_ <- getArgs; let greet = \"Hello, \" <> name; putStrLn greet }"
* )
*
* // When there is not enough space, the content is broken up onto multiple lines
* assert.strictEqual(
* pipe(prettyDo(statements), Render.pretty(10)),
* String.stripMargin(
* `|do name:_ <- getArgs
* | let greet = "Hello, " <> name
* | putStrLn greet`
* )
* )
*
* @since 1.0.0
* @category alternative layouts
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops flatAlt
* @tsplus pipeable effect/printer/Doc flatAlt
* @tsplus location "@effect/printer/Doc"
*/
export declare const flatAlt: <B>(that: Doc<B>) => <A>(self: Doc<A>) => Doc<A | B>;
export declare const flatAlt: {
<B>(that: Doc<B>): <A>(self: Doc<A>) => Doc<B | A>;
<A, B>(self: Doc<A>, that: Doc<B>): Doc<A | B>;
};
/**
* @since 1.0.0
* @category alternative layouts
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops union
* @tsplus pipeable effect/printer/Doc union
* @tsplus location "@effect/printer/Doc"
*/
export declare const union: <B>(that: Doc<B>) => <A>(self: Doc<A>) => Doc<B | A>;
export declare const union: {
<B>(that: Doc<B>): <A>(self: Doc<A>) => Doc<B | A>;
<A, B>(self: Doc<A>, that: Doc<B>): Doc<A | B>;
};
/**

@@ -1318,7 +1267,5 @@ * The `group` combinator attempts to lay out a document onto a single line by

* The `group` function is key to layouts that adapt to available space nicely.
*
* @since 1.0.0
* @category alternative layouts
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops group
* @tsplus getter effect/printer/Doc group
* @tsplus location "@effect/printer/Doc"
*/

@@ -1328,36 +1275,37 @@ export declare const group: <A>(self: Doc<A>) => Doc<A>;

* Lays out a document depending upon the column at which the document starts.
* @example import * as Doc from "@effect/printer/Doc"
import * as Render from "@effect/printer/Render"
import * as String from "@fp-ts/data/String"
// Example 1:
const example1 = Doc.column((l) =>
Doc.hsep([Doc.text("Columns are"), Doc.text(`${l}-based`)])
)
assert.strictEqual(
Render.prettyDefault(example1),
"Columns are 0-based"
)
// Example 2:
const doc = Doc.hsep([
Doc.text("prefix"),
Doc.column((l) => Doc.text(`| <- column ${l}`))
])
const example2 = Doc.vsep([0, 4, 8].map((n) => Doc.indent(n)(doc)))
assert.strictEqual(
Render.prettyDefault(example2),
String.stripMargin(
`|prefix | <- column 7
| prefix | <- column 11
| prefix | <- column 15`
)
)
*
* @example
* import * as Doc from "@effect/printer/Doc"
* import * as Render from "@effect/printer/Render"
* import * as String from "@effect/data/String"
*
* // Example 1:
* const example1 = Doc.column((l) =>
* Doc.hsep([Doc.text("Columns are"), Doc.text(`${l}-based`)])
* )
*
* assert.strictEqual(
* Render.prettyDefault(example1),
* "Columns are 0-based"
* )
*
* // Example 2:
* const doc = Doc.hsep([
* Doc.text("prefix"),
* Doc.column((l) => Doc.text(`| <- column ${l}`))
* ])
*
* const example2 = Doc.vsep([0, 4, 8].map((n) => Doc.indent(n)(doc)))
*
* assert.strictEqual(
* Render.prettyDefault(example2),
* String.stripMargin(
* `|prefix | <- column 7
* | prefix | <- column 11
* | prefix | <- column 15`
* )
* )
*
* @since 1.0.0
* @category reactive layouts
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops column
* @tsplus location "@effect/printer/Doc"
*/

@@ -1368,25 +1316,26 @@ export declare const column: <A>(react: (position: number) => Doc<A>) => Doc<A>;

* current indentation of the document).
* @example import * as Doc from "@effect/printer/Doc"
import * as Render from "@effect/printer/Render"
import * as String from "@fp-ts/data/String"
const doc = Doc.hsep([
Doc.text("prefix"),
Doc.nesting((l) => Doc.squareBracketed(Doc.text(`Nested: ${l}`)))
])
const example = Doc.vsep([0, 4, 8].map((n) => Doc.indent(n)(doc)))
assert.strictEqual(
Render.prettyDefault(example),
String.stripMargin(
`|prefix [Nested: 0]
| prefix [Nested: 4]
| prefix [Nested: 8]`
)
)
*
* @example
* import * as Doc from "@effect/printer/Doc"
* import * as Render from "@effect/printer/Render"
* import * as String from "@effect/data/String"
*
* const doc = Doc.hsep([
* Doc.text("prefix"),
* Doc.nesting((l) => Doc.squareBracketed(Doc.text(`Nested: ${l}`)))
* ])
*
* const example = Doc.vsep([0, 4, 8].map((n) => Doc.indent(n)(doc)))
*
* assert.strictEqual(
* Render.prettyDefault(example),
* String.stripMargin(
* `|prefix [Nested: 0]
* | prefix [Nested: 4]
* | prefix [Nested: 8]`
* )
* )
*
* @since 1.0.0
* @category reactive layouts
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops nesting
* @tsplus location "@effect/printer/Doc"
*/

@@ -1397,76 +1346,80 @@ export declare const nesting: <A>(react: (level: number) => Doc<A>) => Doc<A>;

* document while rendering.
* @example import * as Doc from "@effect/printer/Doc"
import * as Render from "@effect/printer/Render"
import { pipe } from "@fp-ts/data/Function"
import * as String from "@fp-ts/data/String"
const annotate = <A>(doc: Doc.Doc<A>): Doc.Doc<A> =>
pipe(
Doc.squareBracketed(doc),
Doc.width((w) => Doc.text(` <- width: ${w}`))
)
const docs = [
Doc.text("---"),
Doc.text("------"),
Doc.indent(3)(Doc.text("---")),
Doc.vsep([Doc.text("---"), Doc.indent(4)(Doc.text("---"))])
]
const doc = Doc.align(Doc.vsep(docs.map(annotate)))
assert.strictEqual(
Render.prettyDefault(doc),
String.stripMargin(
`|[---] <- width: 5
|[------] <- width: 8
|[ ---] <- width: 8
|[---
| ---] <- width: 8`
)
)
*
* @example
* import * as Doc from "@effect/printer/Doc"
* import * as Render from "@effect/printer/Render"
* import { pipe } from "@effect/data/Function"
* import * as String from "@effect/data/String"
*
* const annotate = <A>(doc: Doc.Doc<A>): Doc.Doc<A> =>
* pipe(
* Doc.squareBracketed(doc),
* Doc.width((w) => Doc.text(` <- width: ${w}`))
* )
*
* const docs = [
* Doc.text("---"),
* Doc.text("------"),
* Doc.indent(3)(Doc.text("---")),
* Doc.vsep([Doc.text("---"), Doc.indent(4)(Doc.text("---"))])
* ]
*
* const doc = Doc.align(Doc.vsep(docs.map(annotate)))
*
* assert.strictEqual(
* Render.prettyDefault(doc),
* String.stripMargin(
* `|[---] <- width: 5
* |[------] <- width: 8
* |[ ---] <- width: 8
* |[---
* | ---] <- width: 8`
* )
* )
*
* @since 1.0.0
* @category reactive layouts
* @since 1.0.0
* @tsplus static effect/printer/Doc.Aspects width
* @tsplus pipeable effect/printer/Doc width
* @tsplus location "@effect/printer/Doc"
*/
export declare const width: <A, B>(react: (width: number) => Doc<A>) => (self: Doc<B>) => Doc<A | B>;
export declare const width: {
<A>(react: (width: number) => Doc<A>): (self: Doc<A>) => Doc<A>;
<A>(self: Doc<A>, react: (width: number) => Doc<A>): Doc<A>;
};
/**
* Lays out a document according to the document"s`PageWidth`.
* @example import * as Doc from "@effect/printer/Doc"
import * as Render from "@effect/printer/Render"
import * as String from "@fp-ts/data/String"
const doc = Doc.hsep([
Doc.text("prefix"),
Doc.pageWidth((pageWidth) => {
switch (pageWidth._tag) {
case "AvailablePerLine": {
const { lineWidth, ribbonFraction } = pageWidth
return Doc.squareBracketed(
Doc.text(`Width: ${lineWidth}, Ribbon Fraction: ${ribbonFraction}`)
)
}
case "Unbounded": {
return Doc.empty
}
}
})
])
const example = Doc.vsep([0, 4, 8].map((n) => Doc.indent(n)(doc)))
assert.strictEqual(
Render.pretty(32)(example),
String.stripMargin(
`|prefix [Width: 32, Ribbon Fraction: 1]
| prefix [Width: 32, Ribbon Fraction: 1]
| prefix [Width: 32, Ribbon Fraction: 1]`
)
)
*
* @example
* import * as Doc from "@effect/printer/Doc"
* import * as Render from "@effect/printer/Render"
* import * as String from "@effect/data/String"
*
* const doc = Doc.hsep([
* Doc.text("prefix"),
* Doc.pageWidth((pageWidth) => {
* switch (pageWidth._tag) {
* case "AvailablePerLine": {
* const { lineWidth, ribbonFraction } = pageWidth
* return Doc.squareBracketed(
* Doc.text(`Width: ${lineWidth}, Ribbon Fraction: ${ribbonFraction}`)
* )
* }
* case "Unbounded": {
* return Doc.empty
* }
* }
* })
* ])
*
* const example = Doc.vsep([0, 4, 8].map((n) => Doc.indent(n)(doc)))
*
* assert.strictEqual(
* Render.pretty(32)(example),
* String.stripMargin(
* `|prefix [Width: 32, Ribbon Fraction: 1]
* | prefix [Width: 32, Ribbon Fraction: 1]
* | prefix [Width: 32, Ribbon Fraction: 1]`
* )
* )
*
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops pageWidth
* @tsplus location "@effect/printer/Doc"
*/

@@ -1487,72 +1440,76 @@ export declare const pageWidth: <A>(react: (pageWidth: PageWidth) => Doc<A>) => Doc<A>;

* any empty space with spaces
* @example import * as Doc from "@effect/printer/Doc"
import * as Render from "@effect/printer/Render"
import { pipe } from "@fp-ts/data/Function"
import * as String from "@fp-ts/data/String"
const doc = Doc.vsep([
pipe(Doc.vsep(Doc.words("lorem ipsum dolor")), Doc.nest(4)),
Doc.text("sit"),
Doc.text("amet")
])
assert.strictEqual(
Render.prettyDefault(doc),
String.stripMargin(
`|lorem
| ipsum
| dolor
|sit
|amet`
)
)
*
* @example
* import * as Doc from "@effect/printer/Doc"
* import * as Render from "@effect/printer/Render"
* import { pipe } from "@effect/data/Function"
* import * as String from "@effect/data/String"
*
* const doc = Doc.vsep([
* pipe(Doc.vsep(Doc.words("lorem ipsum dolor")), Doc.nest(4)),
* Doc.text("sit"),
* Doc.text("amet")
* ])
*
* assert.strictEqual(
* Render.prettyDefault(doc),
* String.stripMargin(
* `|lorem
* | ipsum
* | dolor
* |sit
* |amet`
* )
* )
*
* @since 1.0.0
* @category alignment
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops nest
* @tsplus pipeable effect/printer/Doc nest
* @tsplus location "@effect/printer/Doc"
*/
export declare const nest: (indent: number) => <A>(self: Doc<A>) => Doc<A>;
export declare const nest: {
(indent: number): <A>(self: Doc<A>) => Doc<A>;
<A>(self: Doc<A>, indent: number): Doc<A>;
};
/**
* The `align` combinator lays out a document with the nesting level set to the
* current column.
* @example import * as Doc from "@effect/printer/Doc"
import * as Render from "@effect/printer/Render"
import * as String from "@fp-ts/data/String"
// As an example, the documents below will be placed one above the other
// regardless of the current nesting level
// Without `align`ment, the second line is simply placed below everything
// that has been laid out so far
const unaligned = Doc.hsep([
Doc.text("lorem"),
Doc.vsep([Doc.text("ipsum"), Doc.text("dolor")])
])
assert.strictEqual(
Render.prettyDefault(unaligned),
String.stripMargin(
`|lorem ipsum
|dolor`
)
)
// With `align`ment, the `vsep`ed documents all start at the same column
const aligned = Doc.hsep([
Doc.text("lorem"),
Doc.align(Doc.vsep([Doc.text("ipsum"), Doc.text("dolor")]))
])
assert.strictEqual(
Render.prettyDefault(aligned),
String.stripMargin(
`|lorem ipsum
| dolor`
)
)
*
* @example
* import * as Doc from "@effect/printer/Doc"
* import * as Render from "@effect/printer/Render"
* import * as String from "@effect/data/String"
*
* // As an example, the documents below will be placed one above the other
* // regardless of the current nesting level
*
* // Without `align`ment, the second line is simply placed below everything
* // that has been laid out so far
* const unaligned = Doc.hsep([
* Doc.text("lorem"),
* Doc.vsep([Doc.text("ipsum"), Doc.text("dolor")])
* ])
*
* assert.strictEqual(
* Render.prettyDefault(unaligned),
* String.stripMargin(
* `|lorem ipsum
* |dolor`
* )
* )
*
* // With `align`ment, the `vsep`ed documents all start at the same column
* const aligned = Doc.hsep([
* Doc.text("lorem"),
* Doc.align(Doc.vsep([Doc.text("ipsum"), Doc.text("dolor")]))
* ])
*
* assert.strictEqual(
* Render.prettyDefault(aligned),
* String.stripMargin(
* `|lorem ipsum
* | dolor`
* )
* )
*
* @since 1.0.0
* @category alignment
* @since 1.0.0
* @tsplus getter effect/printer/Doc align
* @tsplus location "@effect/printer/Doc"
*/

@@ -1568,56 +1525,62 @@ export declare const align: <A>(self: Doc<A>) => Doc<A>;

* more efficient combinator (`nest`) first.
* @example import * as Doc from "@effect/printer/Doc"
import * as Render from "@effect/printer/Render"
import { pipe } from "@fp-ts/data/Function"
import * as String from "@fp-ts/data/String"
const doc = Doc.hsep([
Doc.text("prefix"),
pipe(Doc.reflow("Indenting these words with hang"), Doc.hang(4))
])
assert.strictEqual(
Render.pretty(24)(doc),
String.stripMargin(
`|prefix Indenting these
| words with
| hang`
)
)
*
* @example
* import * as Doc from "@effect/printer/Doc"
* import * as Render from "@effect/printer/Render"
* import { pipe } from "@effect/data/Function"
* import * as String from "@effect/data/String"
*
* const doc = Doc.hsep([
* Doc.text("prefix"),
* pipe(Doc.reflow("Indenting these words with hang"), Doc.hang(4))
* ])
*
* assert.strictEqual(
* Render.pretty(24)(doc),
* String.stripMargin(
* `|prefix Indenting these
* | words with
* | hang`
* )
* )
*
* @since 1.0.0
* @category alignment
* @since 1.0.0
* @tsplus static effect/printer/Doc.Aspects hang
* @tsplus pipeable effect/printer/Doc hang
* @tsplus location "@effect/printer/Doc"
*/
export declare const hang: <A>(indent: number) => (self: Doc<A>) => Doc<A>;
export declare const hang: {
(indent: number): <A>(self: Doc<A>) => Doc<A>;
<A>(self: Doc<A>, indent: number): Doc<A>;
};
/**
* The `indent` combinator indents a document by the specified `indent`
* beginning from the current cursor position.
* @example import * as Doc from "@effect/printer/Doc"
import * as Render from "@effect/printer/Render"
import { pipe } from "@fp-ts/data/Function"
import * as String from "@fp-ts/data/String"
const doc = Doc.hcat([
Doc.text("prefix"),
pipe(Doc.reflow("The indent function indents these words!"), Doc.indent(4))
])
assert.strictEqual(
Render.pretty(24)(doc),
String.stripMargin(
`|prefix The indent
| function
| indents these
| words!`
)
)
*
* @example
* import * as Doc from "@effect/printer/Doc"
* import * as Render from "@effect/printer/Render"
* import { pipe } from "@effect/data/Function"
* import * as String from "@effect/data/String"
*
* const doc = Doc.hcat([
* Doc.text("prefix"),
* pipe(Doc.reflow("The indent function indents these words!"), Doc.indent(4))
* ])
*
* assert.strictEqual(
* Render.pretty(24)(doc),
* String.stripMargin(
* `|prefix The indent
* | function
* | indents these
* | words!`
* )
* )
*
* @since 1.0.0
* @category alignment
* @since 1.0.0
* @tsplus static effect/printer/Doc.Aspects indent
* @tsplus pipeable effect/printer/Doc indent
* @tsplus location "@effect/printer/Doc"
*/
export declare const indent: <A>(indent: number) => (self: Doc<A>) => Doc<A>;
export declare const indent: {
(indent: number): <A>(self: Doc<A>) => Doc<A>;
<A>(self: Doc<A>, indent: number): Doc<A>;
};
/**

@@ -1631,61 +1594,66 @@ * The `encloseSep` combinator concatenates a collection of documents,

* combinator.
* @example import * as Doc from "@effect/printer/Doc"
import * as Render from "@effect/printer/Render"
import { pipe } from "@fp-ts/data/Function"
import * as String from "@fp-ts/data/String"
const doc = Doc.hsep([
Doc.text("list"),
Doc.align(
pipe(
["1", "20", "300", "4000"].map(
(n) => n.length === 1 ? Doc.char(n) : Doc.text(n)
),
Doc.encloseSep(Doc.lbracket, Doc.rbracket, Doc.comma)
)
)
])
// The documents are laid out horizontally if the document fits the page
assert.strictEqual(
Render.prettyDefault(doc),
"list [1,20,300,4000]"
)
// Otherwise they are laid out vertically, with separators put in the front
assert.strictEqual(
Render.pretty(10)(doc),
String.stripMargin(
`|list [1
| ,20
| ,300
| ,4000]`
)
)
*
* @example
* import * as Doc from "@effect/printer/Doc"
* import * as Render from "@effect/printer/Render"
* import { pipe } from "@effect/data/Function"
* import * as String from "@effect/data/String"
*
* const doc = Doc.hsep([
* Doc.text("list"),
* Doc.align(
* pipe(
* ["1", "20", "300", "4000"].map(
* (n) => n.length === 1 ? Doc.char(n) : Doc.text(n)
* ),
* Doc.encloseSep(Doc.lbracket, Doc.rbracket, Doc.comma)
* )
* )
* ])
*
* // The documents are laid out horizontally if the document fits the page
* assert.strictEqual(
* Render.prettyDefault(doc),
* "list [1,20,300,4000]"
* )
*
* // Otherwise they are laid out vertically, with separators put in the front
* assert.strictEqual(
* Render.pretty(10)(doc),
* String.stripMargin(
* `|list [1
* | ,20
* | ,300
* | ,4000]`
* )
* )
*
* @since 1.0.0
* @category alignment
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops encloseSep
* @tsplus location "@effect/printer/Doc"
*/
export declare const encloseSep: <A, B, C>(left: Doc<A>, right: Doc<B>, sep: Doc<C>) => <D>(docs: Iterable<Doc<D>>) => Doc<A | B | C | D>;
export declare const encloseSep: {
<A, B, C>(left: Doc<A>, right: Doc<B>, sep: Doc<C>): <D>(docs: Iterable<Doc<D>>) => Doc<A | B | C | D>;
<A, B, C, D>(docs: Iterable<Doc<D>>, left: Doc<A>, right: Doc<B>, sep: Doc<C>): Doc<A | B | C | D>;
};
/**
* A Haskell-inspired variant of `encloseSep` that uses a comma as the separator
* and braces as the enclosure for a collection of documents.
* @example import * as Doc from "@effect/printer/Doc"
import * as Render from "@effect/printer/Render"
const doc = Doc.list(
["1", "20", "300", "4000"].map(
(n) => (n.length === 1 ? Doc.char(n) : Doc.text(n))
)
)
assert.strictEqual(
Render.prettyDefault(doc),
"[1, 20, 300, 4000]"
)
*
* @example
* import * as Doc from "@effect/printer/Doc"
* import * as Render from "@effect/printer/Render"
*
* const doc = Doc.list(
* ["1", "20", "300", "4000"].map(
* (n) => (n.length === 1 ? Doc.char(n) : Doc.text(n))
* )
* )
*
* assert.strictEqual(
* Render.prettyDefault(doc),
* "[1, 20, 300, 4000]"
* )
*
* @since 1.0.0
* @category alignment
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops list
* @tsplus location "@effect/printer/Doc"
*/

@@ -1696,19 +1664,20 @@ export declare const list: <A>(docs: Iterable<Doc<A>>) => Doc<A>;

* and parentheses as the enclosure for a collection of documents.
* @example import * as Doc from "@effect/printer/Doc"
import * as Render from "@effect/printer/Render"
const doc = Doc.tupled(
["1", "20", "300", "4000"].map(
(n) => (n.length === 1 ? Doc.char(n) : Doc.text(n))
)
)
assert.strictEqual(
Render.prettyDefault(doc),
"(1, 20, 300, 4000)"
)
*
* @example
* import * as Doc from "@effect/printer/Doc"
* import * as Render from "@effect/printer/Render"
*
* const doc = Doc.tupled(
* ["1", "20", "300", "4000"].map(
* (n) => (n.length === 1 ? Doc.char(n) : Doc.text(n))
* )
* )
*
* assert.strictEqual(
* Render.prettyDefault(doc),
* "(1, 20, 300, 4000)"
* )
*
* @since 1.0.0
* @category alignment
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops tupled
* @tsplus location "@effect/printer/Doc"
*/

@@ -1720,43 +1689,46 @@ export declare const tupled: <A>(docs: Iterable<Doc<A>>) => Doc<A>;

* If the width of `x` is already larger than the specified `width`, nothing is
* appended.
* @example import * as Doc from "@effect/printer/Doc"
import * as Render from "@effect/printer/Render"
import { pipe } from "@fp-ts/data/Function"
import * as String from "@fp-ts/data/String"
type Signature = [name: string, type: string]
const signatures: Array<Signature> = [
["empty", "Doc"],
["nest", "Int -> Doc -> Doc"],
["fillSep", "[Doc] -> Doc"]
]
const prettySignature = <A>([name, type]: Signature): Doc.Doc<A> =>
Doc.hsep([
pipe(Doc.text(name), Doc.fill(5)),
Doc.text("::"),
Doc.text(type)
])
const doc = Doc.hsep([
Doc.text("let"),
Doc.align(Doc.vcat(signatures.map(prettySignature)))
])
assert.strictEqual(
Render.prettyDefault(doc),
String.stripMargin(
`|let empty :: Doc
| nest :: Int -> Doc -> Doc
| fillSep :: [Doc] -> Doc`
)
)
* appendeinternal.
*
* @example
* import * as Doc from "@effect/printer/Doc"
* import * as Render from "@effect/printer/Render"
* import { pipe } from "@effect/data/Function"
* import * as String from "@effect/data/String"
*
* type Signature = [name: string, type: string]
*
* const signatures: Array<Signature> = [
* ["empty", "Doc"],
* ["nest", "Int -> Doc -> Doc"],
* ["fillSep", "[Doc] -> Doc"]
* ]
*
* const prettySignature = <A>([name, type]: Signature): Doc.Doc<A> =>
* Doc.hsep([
* pipe(Doc.text(name), Doc.fill(5)),
* Doc.text("::"),
* Doc.text(type)
* ])
*
* const doc = Doc.hsep([
* Doc.text("let"),
* Doc.align(Doc.vcat(signatures.map(prettySignature)))
* ])
*
* assert.strictEqual(
* Render.prettyDefault(doc),
* String.stripMargin(
* `|let empty :: Doc
* | nest :: Int -> Doc -> Doc
* | fillSep :: [Doc] -> Doc`
* )
* )
*
* @since 1.0.0
* @category filling
* @since 1.0.0
* @tsplus static effect/printer/Doc.Aspects fill
* @tsplus pipeable effect/printer/Doc fill
* @tsplus location "@effect/printer/Doc"
*/
export declare const fill: <A>(width: number) => (self: Doc<A>) => Doc<A>;
export declare const fill: {
(w: number): <A>(self: Doc<A>) => Doc<A>;
<A>(self: Doc<A>, w: number): Doc<A>;
};
/**

@@ -1766,51 +1738,52 @@ * The `fillBreak` combinator first lays out the document `x` and then appends

* If the width of `x` is already larger than the specified `width`, the nesting
* level is increased by the specified `width` and a `line` is appended.
* @example import * as Doc from "@effect/printer/Doc"
import * as Render from "@effect/printer/Render"
import { pipe } from "@fp-ts/data/Function"
import * as String from "@fp-ts/data/String"
type Signature = [name: string, type: string]
const signatures: Array<Signature> = [
["empty", "Doc"],
["nest", "Int -> Doc -> Doc"],
["fillSep", "[Doc] -> Doc"]
]
const prettySignature = <A>([name, type]: Signature): Doc.Doc<A> =>
Doc.hsep([
pipe(Doc.text(name), Doc.fillBreak(5)),
Doc.text("::"),
Doc.text(type)
])
const doc = Doc.hsep([
Doc.text("let"),
Doc.align(Doc.vcat(signatures.map(prettySignature)))
])
assert.strictEqual(
Render.prettyDefault(doc),
String.stripMargin(
`|let empty :: Doc
| nest :: Int -> Doc -> Doc
| fillSep
| :: [Doc] -> Doc`
)
)
* level is increased by the specified `width` and a `line` is appendeinternal.
*
* @example
* import * as Doc from "@effect/printer/Doc"
* import * as Render from "@effect/printer/Render"
* import { pipe } from "@effect/data/Function"
* import * as String from "@effect/data/String"
*
* type Signature = [name: string, type: string]
*
* const signatures: Array<Signature> = [
* ["empty", "Doc"],
* ["nest", "Int -> Doc -> Doc"],
* ["fillSep", "[Doc] -> Doc"]
* ]
*
* const prettySignature = <A>([name, type]: Signature): Doc.Doc<A> =>
* Doc.hsep([
* pipe(Doc.text(name), Doc.fillBreak(5)),
* Doc.text("::"),
* Doc.text(type)
* ])
*
* const doc = Doc.hsep([
* Doc.text("let"),
* Doc.align(Doc.vcat(signatures.map(prettySignature)))
* ])
*
* assert.strictEqual(
* Render.prettyDefault(doc),
* String.stripMargin(
* `|let empty :: Doc
* | nest :: Int -> Doc -> Doc
* | fillSep
* | :: [Doc] -> Doc`
* )
* )
*
* @since 1.0.0
* @category filling
* @since 1.0.0
* @tsplus static effect/printer/Doc.Aspects fillBreak
* @tsplus pipeable effect/printer/Doc fillBreak
* @tsplus location "@effect/printer/Doc"
*/
export declare const fillBreak: <A>(width: number) => (self: Doc<A>) => Doc<A>;
export declare const fillBreak: {
(w: number): <A>(self: Doc<A>) => Doc<A>;
<A>(self: Doc<A>, w: number): Doc<A>;
};
/**
* Flattens a document but does not report changes.
*
* @since 1.0.0
* @category flattening
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops flatten
* @tsplus getter effect/printer/Doc flatten
* @tsplus location "@effect/printer/Doc"
*/

@@ -1831,7 +1804,5 @@ export declare const flatten: <A>(self: Doc<A>) => Doc<A>;

* contains either a hard `Line` or a `Fail`.
*
* @since 1.0.0
* @category flattening
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops changesUponFlattening
* @tsplus getter effect/printer/Doc changesUponFlattening
* @tsplus location "@effect/printer/Doc"
*/

@@ -1845,9 +1816,10 @@ export declare const changesUponFlattening: <A>(self: Doc<A>) => Flatten<Doc<A>>;

* and is not relevant for basic pretty printing.
*
* @since 1.0.0
* @category annotations
* @since 1.0.0
* @tsplus static effect/printer/Doc.Aspects annotate
* @tsplus pipeable effect/printer/Doc annotate
* @tsplus location "@effect/printer/Doc"
*/
export declare const annotate: <A>(annotation: A) => <B>(self: Doc<B>) => Doc<A | B>;
export declare const annotate: {
<A>(annotation: A): (self: Doc<A>) => Doc<A>;
<A>(self: Doc<A>, annotation: A): Doc<A>;
};
/**

@@ -1870,9 +1842,10 @@ * Change the annotations of a document. Individual annotations can be removed,

* `alterAnnotations` from the `SimpleDocStream` module.
*
* @since 1.0.0
* @category annotations
* @since 1.0.0
* @tsplus static effect/printer/Doc.Aspects alterAnnotations
* @tsplus pipeable effect/printer/Doc alterAnnotations
* @tsplus location "@effect/printer/Doc"
*/
export declare const alterAnnotations: <A, B>(f: (a: A) => Iterable<B>) => (self: Doc<A>) => Doc<B>;
export declare const alterAnnotations: {
<A, B>(f: (a: A) => Iterable<B>): (self: Doc<A>) => Doc<B>;
<A, B>(self: Doc<A>, f: (a: A) => Iterable<B>): Doc<B>;
};
/**

@@ -1882,100 +1855,115 @@ * Changes the annotation of a document. Useful for modifying documents embedded

*
* **Note** that with each invocation, the entire document tree is traversed.
* **Note** that with each invocation, the entire document tree is traverseinternal.
* If possible, it is preferable to reannotate a document after producing the
* layout using `reAnnotateS`.
*
* @since 1.0.0
* @category annotations
* @since 1.0.0
* @tsplus static effect/printer/Doc.Aspects map
* @tsplus static effect/printer/Doc.Aspects reAnnotate
* @tsplus pipeable effect/printer/Doc map
* @tsplus pipeable effect/printer/Doc reAnnotate
* @tsplus location "@effect/printer/Doc"
*/
export declare const reAnnotate: <A, B>(f: (a: A) => B) => (self: Doc<A>) => Doc<B>;
export declare const reAnnotate: {
<A, B>(f: (a: A) => B): (self: Doc<A>) => Doc<B>;
<A, B>(self: Doc<A>, f: (a: A) => B): Doc<B>;
};
/**
* Removes all annotations from a document.
*
* **Note**: with each invocation, the entire document tree is traversed.
* **Note**: with each invocation, the entire document tree is traverseinternal.
* If possible, it is preferable to unannotate a document after producing the
* layout using `unAnnotateS`.
*
* @since 1.0.0
* @category annotations
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops unAnnotate
* @tsplus getter effect/printer/Doc unAnnotate
* @tsplus location "@effect/printer/Doc"
*/
export declare const unAnnotate: <A>(self: Doc<A>) => Doc<never>;
/**
* @since 1.0.0
* @category folding
*/
export declare const match: {
<A, R>(patterns: {
readonly Fail: () => R;
readonly Empty: () => R;
readonly Char: (char: string) => R;
readonly Text: (text: string) => R;
readonly Line: () => R;
readonly FlatAlt: (x: Doc<A>, y: Doc<A>) => R;
readonly Cat: (x: Doc<A>, y: Doc<A>) => R;
readonly Nest: (indent: number, doc: Doc<A>) => R;
readonly Union: (x: Doc<A>, y: Doc<A>) => R;
readonly Column: (react: (position: number) => Doc<A>) => R;
readonly WithPageWidth: (react: (pageWidth: PageWidth) => Doc<A>) => R;
readonly Nesting: (react: (level: number) => Doc<A>) => R;
readonly Annotated: (annotation: A, doc: Doc<A>) => R;
}): (self: Doc<A>) => R;
<A, R>(self: Doc<A>, patterns: {
readonly Fail: () => R;
readonly Empty: () => R;
readonly Char: (char: string) => R;
readonly Text: (text: string) => R;
readonly Line: () => R;
readonly FlatAlt: (x: Doc<A>, y: Doc<A>) => R;
readonly Cat: (x: Doc<A>, y: Doc<A>) => R;
readonly Nest: (indent: number, doc: Doc<A>) => R;
readonly Union: (x: Doc<A>, y: Doc<A>) => R;
readonly Column: (react: (position: number) => Doc<A>) => R;
readonly WithPageWidth: (react: (pageWidth: PageWidth) => Doc<A>) => R;
readonly Nesting: (react: (level: number) => Doc<A>) => R;
readonly Annotated: (annotation: A, doc: Doc<A>) => R;
}): R;
};
export declare const map: {
<A, B>(f: (a: A) => B): (self: Doc<A>) => Doc<B>;
<A, B>(self: Doc<A>, f: (a: A) => B): Doc<B>;
};
/**
* @since 1.0.0
* @tsplus static effect/printer/Doc.Aspects match
* @tsplus pipeable effect/printer/Doc match
* @tsplus location "@effect/printer/Doc"
* @category instances
*/
export declare const match: <A, R>(patterns: {
readonly Fail: () => R;
readonly Empty: () => R;
readonly Char: (char: string) => R;
readonly Text: (text: string) => R;
readonly Line: () => R;
readonly FlatAlt: (x: Doc<A>, y: Doc<A>) => R;
readonly Cat: (x: Doc<A>, y: Doc<A>) => R;
readonly Nest: (indent: number, doc: Doc<A>) => R;
readonly Union: (x: Doc<A>, y: Doc<A>) => R;
readonly Column: (react: (position: number) => Doc<A>) => R;
readonly WithPageWidth: (react: (pageWidth: PageWidth) => Doc<A>) => R;
readonly Nesting: (react: (level: number) => Doc<A>) => R;
readonly Annotated: (annotation: A, doc: Doc<A>) => R;
}) => (self: Doc<A>) => R;
export declare const getSemigroup: <A>(_: void) => Semigroup<Doc<A>>;
/**
* @since 1.0.0
* @category instances
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops getSemigroup
* @tsplus location "@effect/printer/Doc"
*/
export declare const getSemigroup: <A>() => Semigroup<Doc<A>>;
export declare const getMonoid: <A>(_: void) => Monoid<Doc<A>>;
/**
* @since 1.0.0
* @category instances
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops getMonoid
* @tsplus location "@effect/printer/Doc"
*/
export declare const getMonoid: <A>() => Monoid<Doc<A>>;
export declare const Covariant: covariant.Covariant<Doc.TypeLambda>;
/**
* @since 1.0.0
* @category instances
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops Functor
* @tsplus location "@effect/printer/Doc"
*/
export declare const Functor: _Functor<Doc.TypeLambda>;
export declare const Invariant: invariant.Invariant<Doc.TypeLambda>;
/**
* The `surround` combinator encloses a document in between `left` and `right`
* documents.
* @example import * as Doc from "@effect/printer/Doc"
import * as Render from "@effect/printer/Render"
import { pipe } from "@fp-ts/data/Function"
const doc = pipe(
Doc.char("-"),
Doc.surround(Doc.char("A"), Doc.char("Z"))
)
assert.strictEqual(
Render.prettyDefault(doc),
"A-Z"
)
*
* @example
* import * as Doc from "@effect/printer/Doc"
* import * as Render from "@effect/printer/Render"
* import { pipe } from "@effect/data/Function"
*
* const doc = pipe(
* Doc.char("-"),
* Doc.surround(Doc.char("A"), Doc.char("Z"))
* )
*
* assert.strictEqual(
* Render.prettyDefault(doc),
* "A-Z"
* )
*
* @since 1.0.0
* @category utilities
* @since 1.0.0
* @tsplus static effect/printer/Doc.Aspects surround
* @tsplus pipeable effect/printer/Doc surround
* @tsplus location "@effect/printer/Doc"
*/
export declare const surround: <B, C>(left: Doc<B>, right: Doc<C>) => <A>(self: Doc<A>) => Doc<A | B | C>;
export declare const surround: {
<A, B, C>(left: Doc<A>, right: Doc<B>): (self: Doc<C>) => Doc<A | B | C>;
<A, B, C>(self: Doc<C>, left: Doc<A>, right: Doc<B>): Doc<A | B | C>;
};
/**
* Encloses the input document in single quotes (`""`).
*
* @since 1.0.0
* @category utilities
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops singleQuoted
* @tsplus getter effect/printer/Doc singleQuoted
* @tsplus location "@effect/printer/Doc"
*/

@@ -1985,7 +1973,5 @@ export declare const singleQuoted: <A>(self: Doc<A>) => Doc<A>;

* Encloses the input document in double quotes (`""`).
*
* @since 1.0.0
* @category utilities
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops doubleQuoted
* @tsplus getter effect/printer/Doc doubleQuoted
* @tsplus location "@effect/printer/Doc"
*/

@@ -1995,7 +1981,5 @@ export declare const doubleQuoted: <A>(self: Doc<A>) => Doc<A>;

* Encloses the input document in parentheses (`()`).
*
* @since 1.0.0
* @category utilities
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops parenthesized
* @tsplus getter effect/printer/Doc parenthesized
* @tsplus location "@effect/printer/Doc"
*/

@@ -2005,7 +1989,5 @@ export declare const parenthesized: <A>(self: Doc<A>) => Doc<A>;

* Encloses the input document in angle brackets (`<>`).
*
* @since 1.0.0
* @category utilities
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops angledBracketed
* @tsplus getter effect/printer/Doc angledBracketed
* @tsplus location "@effect/printer/Doc"
*/

@@ -2015,7 +1997,5 @@ export declare const angleBracketed: <A>(self: Doc<A>) => Doc<A>;

* Encloses the input document in square brackets (`[]`).
*
* @since 1.0.0
* @category utilities
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops squareBracketed
* @tsplus getter effect/printer/Doc squareBracketed
* @tsplus location "@effect/printer/Doc"
*/

@@ -2025,7 +2005,5 @@ export declare const squareBracketed: <A>(self: Doc<A>) => Doc<A>;

* Encloses the input document in curly braces (`{}`).
*
* @since 1.0.0
* @category utilities
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops curlyBraced
* @tsplus getter effect/printer/Doc curlyBraced
* @tsplus location "@effect/printer/Doc"
*/

@@ -2036,22 +2014,21 @@ export declare const curlyBraced: <A>(self: Doc<A>) => Doc<A>;

* values for `n` count as `0` spaces.
* @example import * as Doc from "@effect/printer/Doc"
import * as Render from "@effect/printer/Render"
const doc = Doc.squareBracketed(Doc.doubleQuoted(Doc.spaces(5)))
assert.strictEqual(
Render.prettyDefault(doc),
"[\" \"]"
)
*
* @example
* import * as Doc from "@effect/printer/Doc"
* import * as Render from "@effect/printer/Render"
*
* const doc = Doc.squareBracketed(Doc.doubleQuoted(Doc.spaces(5)))
*
* assert.strictEqual(
* Render.prettyDefault(doc),
* "[\" \"]"
* )
*
* @since 1.0.0
* @category utilities
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops spaces
* @tsplus location "@effect/printer/Doc"
*/
export declare const spaces: (n: number) => Doc<never>;
/**
* @since 1.0.0
* @category utilities
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops textSpaces
* @tsplus location "@effect/printer/Doc"
*/

@@ -2062,15 +2039,16 @@ export declare const textSpaces: (n: number) => string;

* specified `char` to split on (defaults to `" "`).
* @example import * as Doc from "@effect/printer/Doc"
import * as Render from "@effect/printer/Render"
const doc = Doc.tupled(Doc.words("lorem ipsum dolor"))
assert.strictEqual(
Render.prettyDefault(doc),
"(lorem, ipsum, dolor)"
)
*
* @example
* import * as Doc from "@effect/printer/Doc"
* import * as Render from "@effect/printer/Render"
*
* const doc = Doc.tupled(Doc.words("lorem ipsum dolor"))
*
* assert.strictEqual(
* Render.prettyDefault(doc),
* "(lorem, ipsum, dolor)"
* )
*
* @since 1.0.0
* @category utilities
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops words
* @tsplus location "@effect/printer/Doc"
*/

@@ -2083,25 +2061,26 @@ export declare const words: (s: string, char?: string) => ReadonlyArray<Doc<never>>;

* be broken into multiple lines.
* @example import * as Doc from "@effect/printer/Doc"
import * as Render from "@effect/printer/Render"
import * as String from "@fp-ts/data/String"
const doc = Doc.reflow(
"Lorem ipsum dolor sit amet, consectetur adipisicing elit, " +
"sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
)
assert.strictEqual(
Render.pretty(32)(doc),
String.stripMargin(
`|Lorem ipsum dolor sit amet,
|consectetur adipisicing elit,
|sed do eiusmod tempor incididunt
|ut labore et dolore magna
|aliqua.`
)
)
*
* @example
* import * as Doc from "@effect/printer/Doc"
* import * as Render from "@effect/printer/Render"
* import * as String from "@effect/data/String"
*
* const doc = Doc.reflow(
* "Lorem ipsum dolor sit amet, consectetur adipisicing elit, " +
* "sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
* )
*
* assert.strictEqual(
* Render.pretty(32)(doc),
* String.stripMargin(
* `|Lorem ipsum dolor sit amet,
* |consectetur adipisicing elit,
* |sed do eiusmod tempor incididunt
* |ut labore et dolore magna
* |aliqua.`
* )
* )
*
* @since 1.0.0
* @category utilities
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops reflow
* @tsplus location "@effect/printer/Doc"
*/

@@ -2114,36 +2093,39 @@ export declare const reflow: (s: string, char?: string) => Doc<never>;

* vertically.
* @example import * as Doc from "@effect/printer/Doc"
import * as Render from "@effect/printer/Render"
import { pipe } from "@fp-ts/data/Function"
import * as String from "@fp-ts/data/String"
const docs = pipe(
Doc.words("lorem ipsum dolor sit amet"),
Doc.punctuate(Doc.comma)
)
assert.strictEqual(
Render.prettyDefault(Doc.hsep(docs)),
"lorem, ipsum, dolor, sit, amet"
)
// The separators are put at the end of the entries, which can be better
// visualzied if the documents are rendered vertically
assert.strictEqual(
Render.prettyDefault(Doc.vsep(docs)),
String.stripMargin(
`|lorem,
|ipsum,
|dolor,
|sit,
|amet`
)
)
*
* @example
* import * as Doc from "@effect/printer/Doc"
* import * as Render from "@effect/printer/Render"
* import { pipe } from "@effect/data/Function"
* import * as String from "@effect/data/String"
*
* const docs = pipe(
* Doc.words("lorem ipsum dolor sit amet"),
* Doc.punctuate(Doc.comma)
* )
*
* assert.strictEqual(
* Render.prettyDefault(Doc.hsep(docs)),
* "lorem, ipsum, dolor, sit, amet"
* )
*
* // The separators are put at the end of the entries, which can be better
* // visualzied if the documents are rendered vertically
* assert.strictEqual(
* Render.prettyDefault(Doc.vsep(docs)),
* String.stripMargin(
* `|lorem,
* |ipsum,
* |dolor,
* |sit,
* |amet`
* )
* )
*
* @since 1.0.0
* @category utilities
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops punctuate
* @tsplus location "@effect/printer/Doc"
*/
export declare const punctuate: <A, B>(punctuator: Doc<A>) => (docs: Iterable<Doc<B>>) => ReadonlyArray<Doc<A | B>>;
export {};
export declare const punctuate: {
<A, B>(punctuator: Doc<A>): (docs: Iterable<Doc<B>>) => ReadonlyArray<Doc<A | B>>;
<A, B>(docs: Iterable<Doc<B>>, punctuator: Doc<A>): ReadonlyArray<Doc<A | B>>;
};
//# sourceMappingURL=Doc.d.ts.map

@@ -6,4 +6,4 @@ "use strict";

});
exports.words = exports.width = exports.vsep = exports.vcat = exports.vbar = exports.union = exports.unAnnotate = exports.tupled = exports.textSpaces = exports.text = exports.surround = exports.string = exports.squote = exports.squareBracketed = exports.spaces = exports.space = exports.softLineBreak = exports.softLine = exports.slash = exports.singleQuoted = exports.seps = exports.semi = exports.rparen = exports.reflow = exports.reAnnotate = exports.rbracket = exports.rbrace = exports.rangle = exports.punctuate = exports.parenthesized = exports.pageWidth = exports.nesting = exports.nest = exports.match = exports.lparen = exports.list = exports.lineBreak = exports.line = exports.lbracket = exports.lbrace = exports.langle = exports.isWithPageWidth = exports.isUnion = exports.isText = exports.isNesting = exports.isNest = exports.isLine = exports.isFlatAlt = exports.isFail = exports.isEmpty = exports.isDoc = exports.isColumn = exports.isChar = exports.isCat = exports.isAnnotated = exports.indent = exports.hsep = exports.hcat = exports.hardLine = exports.hang = exports.group = exports.getSemigroup = exports.getMonoid = exports.flatten = exports.flatAlt = exports.fillSep = exports.fillCat = exports.fillBreak = exports.fill = exports.fail = exports.equalSign = exports.encloseSep = exports.empty = exports.dquote = exports.doubleQuoted = exports.dot = exports.curlyBraced = exports.concatWith = exports.comma = exports.column = exports.colon = exports.char = exports.changesUponFlattening = exports.cats = exports.catWithSpace = exports.catWithSoftLineBreak = exports.catWithSoftLine = exports.catWithLineBreak = exports.catWithLine = exports.cat = exports.backslash = exports.annotate = exports.angleBracketed = exports.alterAnnotations = exports.align = exports.Functor = exports.Doc = void 0;
var D = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/printer/internal/Doc"));
exports.words = exports.width = exports.vsep = exports.vcat = exports.vbar = exports.union = exports.unAnnotate = exports.tupled = exports.textSpaces = exports.text = exports.surround = exports.string = exports.squote = exports.squareBracketed = exports.spaces = exports.space = exports.softLineBreak = exports.softLine = exports.slash = exports.singleQuoted = exports.seps = exports.semi = exports.rparen = exports.reflow = exports.reAnnotate = exports.rbracket = exports.rbrace = exports.rangle = exports.punctuate = exports.parenthesized = exports.pageWidth = exports.nesting = exports.nest = exports.match = exports.map = exports.lparen = exports.list = exports.lineBreak = exports.line = exports.lbracket = exports.lbrace = exports.langle = exports.isWithPageWidth = exports.isUnion = exports.isText = exports.isNesting = exports.isNest = exports.isLine = exports.isFlatAlt = exports.isFail = exports.isEmpty = exports.isDoc = exports.isColumn = exports.isChar = exports.isCat = exports.isAnnotated = exports.indent = exports.hsep = exports.hcat = exports.hardLine = exports.hang = exports.group = exports.getSemigroup = exports.getMonoid = exports.flatten = exports.flatAlt = exports.fillSep = exports.fillCat = exports.fillBreak = exports.fill = exports.fail = exports.equalSign = exports.encloseSep = exports.empty = exports.dquote = exports.doubleQuoted = exports.dot = exports.curlyBraced = exports.concatWith = exports.comma = exports.column = exports.colon = exports.char = exports.changesUponFlattening = exports.cats = exports.catWithSpace = exports.catWithSoftLineBreak = exports.catWithSoftLine = exports.catWithLineBreak = exports.catWithLine = exports.cat = exports.backslash = exports.annotate = exports.angleBracketed = exports.alterAnnotations = exports.align = exports.Invariant = exports.DocTypeId = exports.Covariant = void 0;
var internal = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/printer/internal_effect_untraced/doc"));
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

@@ -33,10 +33,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// -----------------------------------------------------------------------------
const TypeId = D.DocTypeId;
/**
* @category instances
* @since 1.0.0
* @category symbol
*/
const Doc = {
$: {}
};
const DocTypeId = internal.DocTypeId;
// -----------------------------------------------------------------------------

@@ -48,138 +45,111 @@ // Refinements

*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops isDoc
*/
exports.Doc = Doc;
const isDoc = D.isDoc;
exports.DocTypeId = DocTypeId;
const isDoc = internal.isDoc;
/**
* Returns `true` if the specified `Doc` is a `Fail`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops isFail
* @tsplus fluent effect/printer/Doc isFail
*/
exports.isDoc = isDoc;
const isFail = D.isFail;
const isFail = internal.isFail;
/**
* Returns `true` if the specified `Doc` is an `Empty`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops isEmpty
* @tsplus fluent effect/printer/Doc isEmpty
*/
exports.isFail = isFail;
const isEmpty = D.isEmpty;
const isEmpty = internal.isEmpty;
/**
* Returns `true` if the specified `Doc` is a `Char`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops isChar
* @tsplus fluent effect/printer/Doc isChar
*/
exports.isEmpty = isEmpty;
const isChar = D.isChar;
const isChar = internal.isChar;
/**
* Returns `true` if the specified `Doc` is a `Text`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops isText
* @tsplus fluent effect/printer/Doc isText
*/
exports.isChar = isChar;
const isText = D.isText;
const isText = internal.isText;
/**
* Returns `true` if the specified `Doc` is a `Line`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops isLine
* @tsplus fluent effect/printer/Doc isLine
*/
exports.isText = isText;
const isLine = D.isLine;
const isLine = internal.isLine;
/**
* Returns `true` if the specified `Doc` is a `FlatAlt`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops isFlatAlt
* @tsplus fluent effect/printer/Doc isFlatAlt
*/
exports.isLine = isLine;
const isFlatAlt = D.isFlatAlt;
const isFlatAlt = internal.isFlatAlt;
/**
* Returns `true` if the specified `Doc` is a `Cat`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops isCat
* @tsplus fluent effect/printer/Doc isCat
*/
exports.isFlatAlt = isFlatAlt;
const isCat = D.isCat;
const isCat = internal.isCat;
/**
* Returns `true` if the specified `Doc` is a `Nest`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops isNest
* @tsplus fluent effect/printer/Doc isNest
*/
exports.isCat = isCat;
const isNest = D.isNest;
const isNest = internal.isNest;
/**
* Returns `true` if the specified `Doc` is a `Union`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops isUnion
* @tsplus fluent effect/printer/Doc isUnion
*/
exports.isNest = isNest;
const isUnion = D.isUnion;
const isUnion = internal.isUnion;
/**
* Returns `true` if the specified `Doc` is a `Column`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops isColumn
* @tsplus fluent effect/printer/Doc isColumn
*/
exports.isUnion = isUnion;
const isColumn = D.isColumn;
const isColumn = internal.isColumn;
/**
* Returns `true` if the specified `Doc` is a `WithPageWidth`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops isWithPageWidth
* @tsplus fluent effect/printer/Doc isWithPageWidth
*/
exports.isColumn = isColumn;
const isWithPageWidth = D.isWithPageWidth;
const isWithPageWidth = internal.isWithPageWidth;
/**
* Returns `true` if the specified `Doc` is a `Nesting`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops isNesting
* @tsplus fluent effect/printer/Doc isNesting
*/
exports.isWithPageWidth = isWithPageWidth;
const isNesting = D.isNesting;
const isNesting = internal.isNesting;
/**
* Returns `true` if the specified `Doc` is a `Annotated`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops isAnnotated
* @tsplus fluent effect/printer/Doc isAnnotated
*/
exports.isNesting = isNesting;
const isAnnotated = D.isAnnotated;
const isAnnotated = internal.isAnnotated;
// -----------------------------------------------------------------------------

@@ -194,8 +164,7 @@ // Constructors

*
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops char
*/
exports.isAnnotated = isAnnotated;
const char = D.char;
const char = internal.char;
/**

@@ -208,8 +177,7 @@ * A document containing a string of text.

*
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops text
*/
exports.char = char;
const text = D.text;
const text = internal.text;
/**

@@ -221,8 +189,7 @@ * Constructs a document containing a string of text.

*
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops string
*/
exports.text = text;
const string = D.string;
const string = internal.string;
// -----------------------------------------------------------------------------

@@ -242,3 +209,3 @@ // Primitives

* import * as Render from "@effect/printer/Render"
* import * as String from "@fp-ts/data/String"
* import * as String from "@effect/data/String"
* import * as assert from "assert"

@@ -248,3 +215,3 @@ *

* Doc.text("hello"),
* Doc.parens(D.empty), // `parens` for visibility purposes only
* Doc.parens(internal.empty), // `parens` for visibility purposes only
* Doc.text("world")

@@ -262,10 +229,9 @@ * ])

*
* @since 1.0.0
* @category primitives
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops empty
*/
exports.string = string;
const empty = D.empty;
const empty = internal.empty;
/**
* The `fail` document is a document that cannot be rendered.
* The `fail` document is a document that cannot be rendereinternal.
*

@@ -275,8 +241,7 @@ * Generally occurs when flattening a line. The layout algorithms will reject

*
* @since 1.0.0
* @category primitives
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops fail
*/
exports.empty = empty;
const fail = D.fail;
const fail = internal.fail;
/**

@@ -290,3 +255,3 @@ * The `line` document advances to the next line and indents to the current

* import * as Render from "@effect/printer/Render"
* import * as String from "@fp-ts/data/String"
* import * as String from "@effect/data/String"
*

@@ -311,8 +276,7 @@ * const doc: Doc.Doc<never> = Doc.hcat([

*
* @since 1.0.0
* @category primitives
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops line
*/
exports.fail = fail;
const line = D.line;
const line = internal.line;
/**

@@ -325,3 +289,3 @@ * The `lineBreak` document is like `line` but behaves like `empty` if the line

* import * as Render from "@effect/printer/Render"
* import * as String from "@fp-ts/data/String"
* import * as String from "@effect/data/String"
*

@@ -346,8 +310,7 @@ * const doc: Doc.Doc<never> = Doc.hcat([

*
* @since 1.0.0
* @category primitives
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops lineBreak
*/
exports.line = line;
const lineBreak = D.lineBreak;
const lineBreak = internal.lineBreak;
/**

@@ -360,3 +323,3 @@ * The `softLine` document behaves like `space` if the resulting output fits

* import * as Render from "@effect/printer/Render"
* import * as String from "@fp-ts/data/String"
* import * as String from "@effect/data/String"
*

@@ -385,8 +348,7 @@ * const doc: Doc.Doc<never> = Doc.hcat([

*
* @since 1.0.0
* @category primitives
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops softLine
*/
exports.lineBreak = lineBreak;
const softLine = D.softLine;
const softLine = internal.softLine;
/**

@@ -400,3 +362,3 @@ * The `softLineBreak` document is similar to `softLine`, but behaves like

* import * as Render from "@effect/printer/Render"
* import * as String from "@fp-ts/data/String"
* import * as String from "@effect/data/String"
*

@@ -425,11 +387,10 @@ * const doc: Doc.Doc<never> = Doc.hcat([

*
* @since 1.0.0
* @category primitives
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops softLineBreak
*/
exports.softLine = softLine;
const softLineBreak = D.softLineBreak;
const softLineBreak = internal.softLineBreak;
/**
* The `hardLine` document is always laid out as a line break, regardless of
* space or whether or not the document was `group`"ed.
* space or whether or not the document was `group`"einternal.
*

@@ -439,3 +400,3 @@ * @example

* import * as Render from "@effect/printer/Render"
* import * as String from "@fp-ts/data/String"
* import * as String from "@effect/data/String"
*

@@ -457,179 +418,159 @@ * const doc: Doc.Doc<never> = Doc.hcat([

*
* @since 1.0.0
* @category primitives
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops hardLine
*/
exports.softLineBreak = softLineBreak;
const hardLine = D.hardLine;
const hardLine = internal.hardLine;
/**
* A document containing a single `\` character.
*
* @since 1.0.0
* @category primitives
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops backslash
*/
exports.hardLine = hardLine;
const backslash = D.backslash;
const backslash = internal.backslash;
/**
* A document containing a single `:` character.
*
* @since 1.0.0
* @category primitives
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops colon
*/
exports.backslash = backslash;
const colon = D.colon;
const colon = internal.colon;
/**
* A document containing a single `,` character.
*
* @since 1.0.0
* @category primitives
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops comma
*/
exports.colon = colon;
const comma = D.comma;
const comma = internal.comma;
/**
* A document containing a single `.` character.
*
* @since 1.0.0
* @category primitives
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops dot
*/
exports.comma = comma;
const dot = D.dot;
const dot = internal.dot;
/**
* A document containing a single `"` character.
*
* @since 1.0.0
* @category primitives
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops dquote
*/
exports.dot = dot;
const dquote = D.dquote;
const dquote = internal.dquote;
/**
* A document containing a single `=` character.
*
* @since 1.0.0
* @category primitives
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops equalSign
*/
exports.dquote = dquote;
const equalSign = D.equalSign;
const equalSign = internal.equalSign;
/**
* A document containing a single `<` character.
*
* @since 1.0.0
* @category primitives
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops langle
*/
exports.equalSign = equalSign;
const langle = D.langle;
const langle = internal.langle;
/**
* A document containing a single `{` character.
*
* @since 1.0.0
* @category primitives
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops lbrace
*/
exports.langle = langle;
const lbrace = D.lbrace;
const lbrace = internal.lbrace;
/**
* A document containing a single `[` character.
*
* @since 1.0.0
* @category primitives
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops lbracket
*/
exports.lbrace = lbrace;
const lbracket = D.lbracket;
const lbracket = internal.lbracket;
/**
* A document containing a single `(` character.
*
* @since 1.0.0
* @category primitives
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops lparen
*/
exports.lbracket = lbracket;
const lparen = D.lparen;
const lparen = internal.lparen;
/**
* A document containing a single `>` character.
*
* @since 1.0.0
* @category primitives
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops rangle
*/
exports.lparen = lparen;
const rangle = D.rangle;
const rangle = internal.rangle;
/**
* A document containing a single `}` character.
*
* @since 1.0.0
* @category primitives
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops rbrace
*/
exports.rangle = rangle;
const rbrace = D.rbrace;
const rbrace = internal.rbrace;
/**
* A document containing a single `]` character.
*
* @since 1.0.0
* @category primitives
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops rbracket
*/
exports.rbrace = rbrace;
const rbracket = D.rbracket;
const rbracket = internal.rbracket;
/**
* A document containing a single `)` character.
*
* @since 1.0.0
* @category primitives
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops rparen
*/
exports.rbracket = rbracket;
const rparen = D.rparen;
const rparen = internal.rparen;
/**
* A document containing a single `;` character.
*
* @since 1.0.0
* @category primitives
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops semi
*/
exports.rparen = rparen;
const semi = D.semi;
const semi = internal.semi;
/**
* A document containing a single `/` character.
*
* @since 1.0.0
* @category primitives
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops slash
*/
exports.semi = semi;
const slash = D.slash;
const slash = internal.slash;
/**
* A document containing a single `"` character.
*
* @since 1.0.0
* @category primitives
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops squote
*/
exports.slash = slash;
const squote = D.squote;
const squote = internal.squote;
/**
* A document containing a single ` ` character.
*
* @since 1.0.0
* @category primitives
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops space
*/
exports.squote = squote;
const space = D.space;
const space = internal.space;
/**
* A document containing a single `|` character.
*
* @since 1.0.0
* @category primitives
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops vbar
*/
exports.space = space;
const vbar = D.vbar;
const vbar = internal.vbar;
// -----------------------------------------------------------------------------

@@ -641,8 +582,7 @@ // Concatenation

*
* @since 1.0.0
* @category concatenation
* @since 1.0.0
* @tsplus pipeable effect/printer/Doc cat
*/
exports.vbar = vbar;
const cat = D.cat;
const cat = internal.cat;
/**

@@ -657,3 +597,3 @@ * The `cats` combinator will attempt to lay out a collection of documents

* import * as Render from "@effect/printer/Render"
* import * as String from "@fp-ts/data/String"
* import * as String from "@effect/data/String"
*

@@ -681,8 +621,7 @@ * const doc: Doc.Doc<never> = Doc.hsep([

*
* @since 1.0.0
* @category concatenation
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops cats
*/
exports.cat = cat;
const cats = D.cats;
const cats = internal.cats;
/**

@@ -695,4 +634,4 @@ * The `catWithLine` combinator concatenates two documents by placing a `line`

* import * as Render from "@effect/printer/Render"
* import { pipe } from "@fp-ts/data/Function"
* import * as String from "@fp-ts/data/String"
* import { pipe } from "@effect/data/Function"
* import * as String from "@effect/data/String"
*

@@ -712,9 +651,7 @@ * const doc: Doc.Doc<never> = pipe(

*
* @since 1.0.0
* @category concatenation
* @since 1.0.0
* @tsplus static effect/printer/Doc.Aspects catWithLine
* @tsplus pipeable effect/printer/Doc catWithLine
*/
exports.cats = cats;
const catWithLine = D.catWithLine;
const catWithLine = internal.catWithLine;
/**

@@ -727,4 +664,4 @@ * The `catWithLineBreak` combinator concatenates two documents by placing a

* import * as Render from "@effect/printer/Render"
* import { pipe } from "@fp-ts/data/Function"
* import * as String from "@fp-ts/data/String"
* import { pipe } from "@effect/data/Function"
* import * as String from "@effect/data/String"
*

@@ -749,9 +686,7 @@ * const doc: Doc.Doc<never> = pipe(

*
* @since 1.0.0
* @category concatenation
* @since 1.0.0
* @tsplus static effect/printer/Doc.Aspects catWithLineBreak
* @tsplus pipeable effect/printer/Doc catWithLineBreak
*/
exports.catWithLine = catWithLine;
const catWithLineBreak = D.catWithLineBreak;
const catWithLineBreak = internal.catWithLineBreak;
/**

@@ -764,4 +699,4 @@ * The `catWithSoftLine` combinator concatenates two documents by placing a

* import * as Render from "@effect/printer/Render"
* import { pipe } from "@fp-ts/data/Function"
* import * as String from "@fp-ts/data/String"
* import { pipe } from "@effect/data/Function"
* import * as String from "@effect/data/String"
*

@@ -786,9 +721,7 @@ * const doc: Doc.Doc<never> = pipe(

*
* @since 1.0.0
* @category concatenation
* @since 1.0.0
* @tsplus static effect/printer/Doc.Aspects catWithSoftLine
* @tsplus pipeable effect/printer/Doc catWithSoftLine
*/
exports.catWithLineBreak = catWithLineBreak;
const catWithSoftLine = D.catWithSoftLine;
const catWithSoftLine = internal.catWithSoftLine;
/**

@@ -801,4 +734,4 @@ * The `catWithSoftLineBreak` combinator concatenates two documents by

* import * as Render from "@effect/printer/Render"
* import { pipe } from "@fp-ts/data/Function"
* import * as String from "@fp-ts/data/String"
* import { pipe } from "@effect/data/Function"
* import * as String from "@effect/data/String"
*

@@ -823,9 +756,7 @@ * const doc: Doc.Doc<never> = pipe(

*
* @since 1.0.0
* @category concatenation
* @since 1.0.0
* @tsplus static effect/printer/Doc.Aspects catWithSoftLineBreak
* @tsplus pipeable effect/printer/Doc catWithSoftLineBreak
*/
exports.catWithSoftLine = catWithSoftLine;
const catWithSoftLineBreak = D.catWithSoftLineBreak;
const catWithSoftLineBreak = internal.catWithSoftLineBreak;
/**

@@ -838,3 +769,3 @@ * The `catWithSpace` combinator concatenates two documents by placing a

* import * as Render from "@effect/printer/Render"
* import { pipe } from "@fp-ts/data/Function"
* import { pipe } from "@effect/data/Function"
*

@@ -851,9 +782,7 @@ * const doc: Doc.Doc<never> = pipe(

*
* @since 1.0.0
* @category concatenation
* @since 1.0.0
* @tsplus static effect/printer/Doc.Aspects catWithSpace
* @tsplus pipeable effect/printer/Doc catWithSpace
*/
exports.catWithSoftLineBreak = catWithSoftLineBreak;
const catWithSpace = D.catWithSpace;
const catWithSpace = internal.catWithSpace;
/**

@@ -866,3 +795,3 @@ * The `concatWith` combinator concatenates all documents in a collection

* import * as Render from "@effect/printer/Render"
* import { pipe } from "@fp-ts/data/Function"
* import { pipe } from "@effect/data/Function"
*

@@ -879,11 +808,10 @@ * const doc: Doc.Doc<never> = pipe(

*
* @since 1.0.0
* @category concatenation
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops concatWith
*/
exports.catWithSpace = catWithSpace;
const concatWith = D.concatWith;
const concatWith = internal.concatWith;
/**
* The `vcat` combinator concatenates all documents in a collection vertically.
* If the output is grouped then the line breaks are removed.
* If the output is grouped then the line breaks are removeinternal.
*

@@ -896,3 +824,3 @@ * In other words `vcat` is like `vsep`, with newlines removed instead of

* import * as Render from "@effect/printer/Render"
* import * as String from "@fp-ts/data/String"
* import * as String from "@effect/data/String"
*

@@ -910,8 +838,7 @@ * const doc: Doc.Doc<never> = Doc.vcat(Doc.words("lorem ipsum dolor"))

*
* @since 1.0.0
* @category concatenation
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops vcat
*/
exports.concatWith = concatWith;
const vcat = D.vcat;
const vcat = internal.vcat;
/**

@@ -923,3 +850,3 @@ * The `hcat` combinator concatenates all documents in a collection horizontally

* import * as Render from "@effect/printer/Render"
* import * as String from "@fp-ts/data/String"
* import * as String from "@effect/data/String"
*

@@ -933,8 +860,7 @@ * const doc: Doc.Doc<never> = Doc.hcat(Doc.words("lorem ipsum dolor"))

*
* @since 1.0.0
* @category concatenation
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops hcat
*/
exports.vcat = vcat;
const hcat = D.hcat;
const hcat = internal.hcat;
/**

@@ -948,10 +874,9 @@ * The `fillCat` combinator concatenates all documents in a collection

* be separated with `empty` instead of newlines. See `fillSep` if you want a
* `space` instead.
* `space` insteainternal.
*
* @since 1.0.0
* @category concatenation
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops fillCat
*/
exports.hcat = hcat;
const fillCat = D.fillCat;
const fillCat = internal.fillCat;
// -----------------------------------------------------------------------------

@@ -984,12 +909,11 @@ // Separation

*
* @since 1.0.0
* @category separation
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops hsep
*/
exports.fillCat = fillCat;
const hsep = D.hsep;
const hsep = internal.hsep;
/**
* The `vsep` combinator concatenates all documents in a collection vertically.
* If a `group` undoes the line breaks inserted by `vsep`, the documents are
* separated with a space instead.
* separated with a space insteainternal.
*

@@ -1003,3 +927,3 @@ * When a `vsep` is `group`ed, the documents are separated with a `space` if the

* import * as Render from "@effect/printer/Render"
* import * as String from "@fp-ts/data/String"
* import * as String from "@effect/data/String"
*

@@ -1038,8 +962,7 @@ * const unaligned = Doc.hsep([

*
* @since 1.0.0
* @category separation
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops vsep
*/
exports.hsep = hsep;
const vsep = D.vsep;
const vsep = internal.vsep;
/**

@@ -1055,8 +978,7 @@ * The `fillSep` combinator concatenates all documents in a collection

*
* @since 1.0.0
* @category separation
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops fillSep
*/
exports.vsep = vsep;
const fillSep = D.fillSep;
const fillSep = internal.fillSep;
/**

@@ -1071,3 +993,3 @@ * The `seps` combinator will attempt to lay out a collection of documents

* import * as Render from "@effect/printer/Render"
* import * as String from "@fp-ts/data/String"
* import * as String from "@effect/data/String"
*

@@ -1095,8 +1017,7 @@ * const doc: Doc.Doc<never> = Doc.hsep([

*
* @since 1.0.0
* @category separation
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops seps
*/
exports.fillSep = fillSep;
const seps = D.seps;
const seps = internal.seps;
// -----------------------------------------------------------------------------

@@ -1118,4 +1039,4 @@ // Alternative Layouts

* import * as Render from "@effect/printer/Render"
* import { pipe } from "@fp-ts/data/Function"
* import * as String from "@fp-ts/data/String"
* import { pipe } from "@effect/data/Function"
* import * as String from "@effect/data/String"
*

@@ -1162,17 +1083,13 @@ * const open = pipe(Doc.empty, Doc.flatAlt(Doc.text("{ ")))

*
* @since 1.0.0
* @category alternative layouts
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops flatAlt
* @tsplus pipeable effect/printer/Doc flatAlt
*/
exports.seps = seps;
const flatAlt = D.flatAlt;
const flatAlt = internal.flatAlt;
/**
* @since 1.0.0
* @category alternative layouts
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops union
* @tsplus pipeable effect/printer/Doc union
*/
exports.flatAlt = flatAlt;
const union = D.union;
const union = internal.union;
/**

@@ -1186,9 +1103,7 @@ * The `group` combinator attempts to lay out a document onto a single line by

*
* @since 1.0.0
* @category alternative layouts
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops group
* @tsplus getter effect/printer/Doc group
*/
exports.union = union;
const group = D.group;
const group = internal.group;
// -----------------------------------------------------------------------------

@@ -1203,3 +1118,3 @@ // Reactive Layouts

* import * as Render from "@effect/printer/Render"
* import * as String from "@fp-ts/data/String"
* import * as String from "@effect/data/String"
*

@@ -1233,8 +1148,7 @@ * // Example 1:

*
* @since 1.0.0
* @category reactive layouts
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops column
*/
exports.group = group;
const column = D.column;
const column = internal.column;
/**

@@ -1247,3 +1161,3 @@ * Lays out a document depending upon the current nesting level (i.e., the

* import * as Render from "@effect/printer/Render"
* import * as String from "@fp-ts/data/String"
* import * as String from "@effect/data/String"
*

@@ -1266,8 +1180,7 @@ * const doc = Doc.hsep([

*
* @since 1.0.0
* @category reactive layouts
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops nesting
*/
exports.column = column;
const nesting = D.nesting;
const nesting = internal.nesting;
/**

@@ -1280,4 +1193,4 @@ * The `width` combinator makes the column width of a document available to the

* import * as Render from "@effect/printer/Render"
* import { pipe } from "@fp-ts/data/Function"
* import * as String from "@fp-ts/data/String"
* import { pipe } from "@effect/data/Function"
* import * as String from "@effect/data/String"
*

@@ -1310,9 +1223,7 @@ * const annotate = <A>(doc: Doc.Doc<A>): Doc.Doc<A> =>

*
* @since 1.0.0
* @category reactive layouts
* @since 1.0.0
* @tsplus static effect/printer/Doc.Aspects width
* @tsplus pipeable effect/printer/Doc width
*/
exports.nesting = nesting;
const width = D.width;
const width = internal.width;
/**

@@ -1324,3 +1235,3 @@ * Lays out a document according to the document"s`PageWidth`.

* import * as Render from "@effect/printer/Render"
* import * as String from "@fp-ts/data/String"
* import * as String from "@effect/data/String"
*

@@ -1355,8 +1266,7 @@ * const doc = Doc.hsep([

*
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops pageWidth
*/
exports.width = width;
const pageWidth = D.pageWidth;
const pageWidth = internal.pageWidth;
// -----------------------------------------------------------------------------

@@ -1382,4 +1292,4 @@ // Alignment

* import * as Render from "@effect/printer/Render"
* import { pipe } from "@fp-ts/data/Function"
* import * as String from "@fp-ts/data/String"
* import { pipe } from "@effect/data/Function"
* import * as String from "@effect/data/String"
*

@@ -1403,9 +1313,7 @@ * const doc = Doc.vsep([

*
* @since 1.0.0
* @category alignment
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops nest
* @tsplus pipeable effect/printer/Doc nest
*/
exports.pageWidth = pageWidth;
const nest = D.nest;
const nest = internal.nest;
/**

@@ -1418,3 +1326,3 @@ * The `align` combinator lays out a document with the nesting level set to the

* import * as Render from "@effect/printer/Render"
* import * as String from "@fp-ts/data/String"
* import * as String from "@effect/data/String"
*

@@ -1453,8 +1361,7 @@ * // As an example, the documents below will be placed one above the other

*
* @since 1.0.0
* @category alignment
* @since 1.0.0
* @tsplus getter effect/printer/Doc align
*/
exports.nest = nest;
const align = D.align;
const align = internal.align;
/**

@@ -1472,4 +1379,4 @@ * The `hang` combinator lays out a document with the nesting level set to

* import * as Render from "@effect/printer/Render"
* import { pipe } from "@fp-ts/data/Function"
* import * as String from "@fp-ts/data/String"
* import { pipe } from "@effect/data/Function"
* import * as String from "@effect/data/String"
*

@@ -1490,9 +1397,7 @@ * const doc = Doc.hsep([

*
* @since 1.0.0
* @category alignment
* @since 1.0.0
* @tsplus static effect/printer/Doc.Aspects hang
* @tsplus pipeable effect/printer/Doc hang
*/
exports.align = align;
const hang = D.hang;
const hang = internal.hang;
/**

@@ -1505,4 +1410,4 @@ * The `indent` combinator indents a document by the specified `indent`

* import * as Render from "@effect/printer/Render"
* import { pipe } from "@fp-ts/data/Function"
* import * as String from "@fp-ts/data/String"
* import { pipe } from "@effect/data/Function"
* import * as String from "@effect/data/String"
*

@@ -1524,9 +1429,7 @@ * const doc = Doc.hcat([

*
* @since 1.0.0
* @category alignment
* @since 1.0.0
* @tsplus static effect/printer/Doc.Aspects indent
* @tsplus pipeable effect/printer/Doc indent
*/
exports.hang = hang;
const indent = D.indent;
const indent = internal.indent;
/**

@@ -1544,4 +1447,4 @@ * The `encloseSep` combinator concatenates a collection of documents,

* import * as Render from "@effect/printer/Render"
* import { pipe } from "@fp-ts/data/Function"
* import * as String from "@fp-ts/data/String"
* import { pipe } from "@effect/data/Function"
* import * as String from "@effect/data/String"
*

@@ -1577,8 +1480,7 @@ * const doc = Doc.hsep([

*
* @since 1.0.0
* @category alignment
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops encloseSep
*/
exports.indent = indent;
const encloseSep = D.encloseSep;
const encloseSep = internal.encloseSep;
/**

@@ -1603,8 +1505,7 @@ * A Haskell-inspired variant of `encloseSep` that uses a comma as the separator

*
* @since 1.0.0
* @category alignment
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops list
*/
exports.encloseSep = encloseSep;
const list = D.list;
const list = internal.list;
/**

@@ -1629,8 +1530,7 @@ * A Haskell-inspired variant of `encloseSep` that uses a comma as the separator

*
* @since 1.0.0
* @category alignment
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops tupled
*/
exports.list = list;
const tupled = D.tupled;
const tupled = internal.tupled;
// -----------------------------------------------------------------------------

@@ -1643,3 +1543,3 @@ // Filling

* If the width of `x` is already larger than the specified `width`, nothing is
* appended.
* appendeinternal.
*

@@ -1649,4 +1549,4 @@ * @example

* import * as Render from "@effect/printer/Render"
* import { pipe } from "@fp-ts/data/Function"
* import * as String from "@fp-ts/data/String"
* import { pipe } from "@effect/data/Function"
* import * as String from "@effect/data/String"
*

@@ -1682,9 +1582,7 @@ * type Signature = [name: string, type: string]

*
* @since 1.0.0
* @category filling
* @since 1.0.0
* @tsplus static effect/printer/Doc.Aspects fill
* @tsplus pipeable effect/printer/Doc fill
*/
exports.tupled = tupled;
const fill = D.fill;
const fill = internal.fill;
/**

@@ -1694,3 +1592,3 @@ * The `fillBreak` combinator first lays out the document `x` and then appends

* If the width of `x` is already larger than the specified `width`, the nesting
* level is increased by the specified `width` and a `line` is appended.
* level is increased by the specified `width` and a `line` is appendeinternal.
*

@@ -1700,4 +1598,4 @@ * @example

* import * as Render from "@effect/printer/Render"
* import { pipe } from "@fp-ts/data/Function"
* import * as String from "@fp-ts/data/String"
* import { pipe } from "@effect/data/Function"
* import * as String from "@effect/data/String"
*

@@ -1734,9 +1632,7 @@ * type Signature = [name: string, type: string]

*
* @since 1.0.0
* @category filling
* @since 1.0.0
* @tsplus static effect/printer/Doc.Aspects fillBreak
* @tsplus pipeable effect/printer/Doc fillBreak
*/
exports.fill = fill;
const fillBreak = D.fillBreak;
const fillBreak = internal.fillBreak;
// -----------------------------------------------------------------------------

@@ -1748,9 +1644,7 @@ // Flattening

*
* @since 1.0.0
* @category flattening
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops flatten
* @tsplus getter effect/printer/Doc flatten
*/
exports.fillBreak = fillBreak;
const flatten = D.flatten;
const flatten = internal.flatten;
/**

@@ -1770,9 +1664,7 @@ * Select the first element of each `Union` and discard the first element of

*
* @since 1.0.0
* @category flattening
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops changesUponFlattening
* @tsplus getter effect/printer/Doc changesUponFlattening
*/
exports.flatten = flatten;
const changesUponFlattening = D.changesUponFlattening;
const changesUponFlattening = internal.changesUponFlattening;
// -----------------------------------------------------------------------------

@@ -1788,9 +1680,7 @@ // Annotations

*
* @since 1.0.0
* @category annotations
* @since 1.0.0
* @tsplus static effect/printer/Doc.Aspects annotate
* @tsplus pipeable effect/printer/Doc annotate
*/
exports.changesUponFlattening = changesUponFlattening;
const annotate = D.annotate;
const annotate = internal.annotate;
/**

@@ -1814,9 +1704,7 @@ * Change the annotations of a document. Individual annotations can be removed,

*
* @since 1.0.0
* @category annotations
* @since 1.0.0
* @tsplus static effect/printer/Doc.Aspects alterAnnotations
* @tsplus pipeable effect/printer/Doc alterAnnotations
*/
exports.annotate = annotate;
const alterAnnotations = D.alterAnnotations;
const alterAnnotations = internal.alterAnnotations;
/**

@@ -1826,29 +1714,23 @@ * Changes the annotation of a document. Useful for modifying documents embedded

*
* **Note** that with each invocation, the entire document tree is traversed.
* **Note** that with each invocation, the entire document tree is traverseinternal.
* If possible, it is preferable to reannotate a document after producing the
* layout using `reAnnotateS`.
*
* @since 1.0.0
* @category annotations
* @since 1.0.0
* @tsplus static effect/printer/Doc.Aspects map
* @tsplus static effect/printer/Doc.Aspects reAnnotate
* @tsplus pipeable effect/printer/Doc map
* @tsplus pipeable effect/printer/Doc reAnnotate
*/
exports.alterAnnotations = alterAnnotations;
const reAnnotate = D.reAnnotate;
const reAnnotate = internal.reAnnotate;
/**
* Removes all annotations from a document.
*
* **Note**: with each invocation, the entire document tree is traversed.
* **Note**: with each invocation, the entire document tree is traverseinternal.
* If possible, it is preferable to unannotate a document after producing the
* layout using `unAnnotateS`.
*
* @since 1.0.0
* @category annotations
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops unAnnotate
* @tsplus getter effect/printer/Doc unAnnotate
*/
exports.reAnnotate = reAnnotate;
const unAnnotate = D.unAnnotate;
const unAnnotate = internal.unAnnotate;
// -----------------------------------------------------------------------------

@@ -1858,33 +1740,36 @@ // Folding

/**
* @since 1.0.0
* @category folding
* @since 1.0.0
* @tsplus static effect/printer/Doc.Aspects match
* @tsplus pipeable effect/printer/Doc match
*/
exports.unAnnotate = unAnnotate;
const match = D.match;
const match = internal.match;
// -----------------------------------------------------------------------------
// Instances
// -----------------------------------------------------------------------------
exports.match = match;
const map = internal.map;
/**
* @since 1.0.0
* @category instances
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops getSemigroup
*/
exports.match = match;
const getSemigroup = D.getSemigroup;
exports.map = map;
const getSemigroup = internal.getSemigroup;
/**
* @since 1.0.0
* @category instances
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops getMonoid
*/
exports.getSemigroup = getSemigroup;
const getMonoid = D.getMonoid;
const getMonoid = internal.getMonoid;
/**
* @since 1.0.0
* @category instances
*/
exports.getMonoid = getMonoid;
const Covariant = internal.Covariant;
/**
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops Functor
* @category instances
*/
exports.getMonoid = getMonoid;
const Functor = D.Functor;
exports.Covariant = Covariant;
const Invariant = internal.Invariant;
// -----------------------------------------------------------------------------

@@ -1900,3 +1785,3 @@ // Utilities

* import * as Render from "@effect/printer/Render"
* import { pipe } from "@fp-ts/data/Function"
* import { pipe } from "@effect/data/Function"
*

@@ -1913,69 +1798,55 @@ * const doc = pipe(

*
* @since 1.0.0
* @category utilities
* @since 1.0.0
* @tsplus static effect/printer/Doc.Aspects surround
* @tsplus pipeable effect/printer/Doc surround
*/
exports.Functor = Functor;
const surround = D.surround;
exports.Invariant = Invariant;
const surround = internal.surround;
/**
* Encloses the input document in single quotes (`""`).
*
* @since 1.0.0
* @category utilities
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops singleQuoted
* @tsplus getter effect/printer/Doc singleQuoted
*/
exports.surround = surround;
const singleQuoted = D.singleQuoted;
const singleQuoted = internal.singleQuoted;
/**
* Encloses the input document in double quotes (`""`).
*
* @since 1.0.0
* @category utilities
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops doubleQuoted
* @tsplus getter effect/printer/Doc doubleQuoted
*/
exports.singleQuoted = singleQuoted;
const doubleQuoted = D.doubleQuoted;
const doubleQuoted = internal.doubleQuoted;
/**
* Encloses the input document in parentheses (`()`).
*
* @since 1.0.0
* @category utilities
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops parenthesized
* @tsplus getter effect/printer/Doc parenthesized
*/
exports.doubleQuoted = doubleQuoted;
const parenthesized = D.parenthesized;
const parenthesized = internal.parenthesized;
/**
* Encloses the input document in angle brackets (`<>`).
*
* @since 1.0.0
* @category utilities
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops angledBracketed
* @tsplus getter effect/printer/Doc angledBracketed
*/
exports.parenthesized = parenthesized;
const angleBracketed = D.angleBracketed;
const angleBracketed = internal.angleBracketed;
/**
* Encloses the input document in square brackets (`[]`).
*
* @since 1.0.0
* @category utilities
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops squareBracketed
* @tsplus getter effect/printer/Doc squareBracketed
*/
exports.angleBracketed = angleBracketed;
const squareBracketed = D.squareBracketed;
const squareBracketed = internal.squareBracketed;
/**
* Encloses the input document in curly braces (`{}`).
*
* @since 1.0.0
* @category utilities
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops curlyBraced
* @tsplus getter effect/printer/Doc curlyBraced
*/
exports.squareBracketed = squareBracketed;
const curlyBraced = D.curlyBraced;
const curlyBraced = internal.curlyBraced;
/**

@@ -1996,15 +1867,13 @@ * The `spaces` combinator lays out a document containing `n` spaces. Negative

*
* @since 1.0.0
* @category utilities
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops spaces
*/
exports.curlyBraced = curlyBraced;
const spaces = D.spaces;
const spaces = internal.spaces;
/**
* @since 1.0.0
* @category utilities
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops textSpaces
*/
exports.spaces = spaces;
const textSpaces = D.textSpaces;
const textSpaces = internal.textSpaces;
/**

@@ -2025,8 +1894,7 @@ * Splits a string of words into individual `Text` documents using the

*
* @since 1.0.0
* @category utilities
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops words
*/
exports.textSpaces = textSpaces;
const words = D.words;
const words = internal.words;
/**

@@ -2041,3 +1909,3 @@ * Splits a string of words into individual `Text` documents using the specified

* import * as Render from "@effect/printer/Render"
* import * as String from "@fp-ts/data/String"
* import * as String from "@effect/data/String"
*

@@ -2060,8 +1928,7 @@ * const doc = Doc.reflow(

*
* @since 1.0.0
* @category utilities
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops reflow
*/
exports.words = words;
const reflow = D.reflow;
const reflow = internal.reflow;
/**

@@ -2076,4 +1943,4 @@ * The `punctuate` combinator appends the `punctuator` document to all but the

* import * as Render from "@effect/printer/Render"
* import { pipe } from "@fp-ts/data/Function"
* import * as String from "@fp-ts/data/String"
* import { pipe } from "@effect/data/Function"
* import * as String from "@effect/data/String"
*

@@ -2103,9 +1970,8 @@ * const docs = pipe(

*
* @since 1.0.0
* @category utilities
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops punctuate
*/
exports.reflow = reflow;
const punctuate = D.punctuate;
const punctuate = internal.punctuate;
exports.punctuate = punctuate;
//# sourceMappingURL=Doc.js.map
/**
* @since 1.0.0
*/
import type { TypeLambda } from "@fp-ts/core/HKT";
import type { Covariant as _Functor } from "@fp-ts/core/typeclass/Covariant";
import type { Monoid } from "@fp-ts/core/typeclass/Monoid";
import type { Option } from "@fp-ts/data/Option";
declare const TypeId: unique symbol;
import type { Equal } from "@effect/data/Equal";
import type { TypeLambda } from "@effect/data/HKT";
import type { Option } from "@effect/data/Option";
import type * as covariant from "@effect/data/typeclass/Covariant";
import type * as invariant from "@effect/data/typeclass/Invariant";
import type * as monoid from "@effect/data/typeclass/Monoid";
/**
* @since 1.0.0
* @category symbol
*/
export declare const DocStreamTypeId: unique symbol;
/**
* @since 1.0.0
* @category symbol
*/
export type TypeId = typeof TypeId;
export type DocStreamTypeId = typeof DocStreamTypeId;
/**

@@ -24,5 +30,4 @@ * Represents a document that has been laid out and can be processed used by the

*
* @since 1.0.0
* @category model
* @since 1.0.0
* @tsplus type effect/printer/DocStream
*/

@@ -34,20 +39,20 @@ export type DocStream<A> = FailedStream<A> | EmptyStream<A> | CharStream<A> | TextStream<A> | LineStream<A> | PushAnnotationStream<A> | PopAnnotationStream<A>;

export declare namespace DocStream {
/**
* @since 1.0.0
* @category model
*/
interface Variance<A> extends Equal {
readonly [DocStreamTypeId]: {
readonly _A: (_: never) => A;
};
}
/**
* @since 1.0.0
* @category model
*/
type TypeLambda = DocStreamTypeLambda;
}
/**
* @category model
* @since 1.0.0
* @tsplus type effect/printer/DocStream.Ops
*/
export interface DocStreamOps {
$: DocStreamAspects;
}
/**
* @category instances
* @since 1.0.0
*/
export declare const DocStream: DocStreamOps;
/**
* @category model
* @since 1.0.0
*/

@@ -58,19 +63,9 @@ export interface DocStreamTypeLambda extends TypeLambda {

/**
* @category model
* @since 1.0.0
*
* @tsplus type effect/printer/DocStream.Aspects
*/
export interface DocStreamAspects {
}
/**
* Represents a `Doc` that failed to be laid out.
*
* @since 1.0.0
* @category model
* @since 1.0.0
*/
export interface FailedStream<A> {
export interface FailedStream<A> extends DocStream.Variance<A> {
readonly _tag: "FailedStream";
readonly _id: TypeId;
readonly _A: (_: never) => A;
}

@@ -80,9 +75,7 @@ /**

*
* @since 1.0.0
* @category model
* @since 1.0.0
*/
export interface EmptyStream<A> {
export interface EmptyStream<A> extends DocStream.Variance<A> {
readonly _tag: "EmptyStream";
readonly _id: TypeId;
readonly _A: (_: never) => A;
}

@@ -92,9 +85,7 @@ /**

*
* @since 1.0.0
* @category model
* @since 1.0.0
*/
export interface CharStream<A> {
export interface CharStream<A> extends DocStream.Variance<A> {
readonly _tag: "CharStream";
readonly _id: TypeId;
readonly _A: (_: never) => A;
readonly char: string;

@@ -106,9 +97,7 @@ readonly stream: DocStream<A>;

*
* @since 1.0.0
* @category model
* @since 1.0.0
*/
export interface TextStream<A> {
export interface TextStream<A> extends DocStream.Variance<A> {
readonly _tag: "TextStream";
readonly _id: TypeId;
readonly _A: (_: never) => A;
readonly text: string;

@@ -122,9 +111,7 @@ readonly stream: DocStream<A>;

*
* @since 1.0.0
* @category model
* @since 1.0.0
*/
export interface LineStream<A> {
export interface LineStream<A> extends DocStream.Variance<A> {
readonly _tag: "LineStream";
readonly _id: TypeId;
readonly _A: (_: never) => A;
readonly indentation: number;

@@ -136,9 +123,7 @@ readonly stream: DocStream<A>;

*
* @since 1.0.0
* @category model
* @since 1.0.0
*/
export interface PushAnnotationStream<A> {
export interface PushAnnotationStream<A> extends DocStream.Variance<A> {
readonly _tag: "PushAnnotationStream";
readonly _id: TypeId;
readonly _A: (_: never) => A;
readonly annotation: A;

@@ -150,9 +135,7 @@ readonly stream: DocStream<A>;

*
* @since 1.0.0
* @category model
* @since 1.0.0
*/
export interface PopAnnotationStream<A> {
export interface PopAnnotationStream<A> extends DocStream.Variance<A> {
readonly _tag: "PopAnnotationStream";
readonly _id: TypeId;
readonly _A: (_: never) => A;
readonly stream: DocStream<A>;

@@ -162,6 +145,5 @@ }

* Returns `true` if the specified value is a `DocStream`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus static effect/printer/DocStream.Ops isDocStream
* @tsplus location "@effect/printer/DocStream"
*/

@@ -171,6 +153,5 @@ export declare const isDocStream: (u: unknown) => u is DocStream<unknown>;

* Returns `true` if the specified `DocStream` is a `FailedStream`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus fluent effect/printer/DocStream isFailedStream
* @tsplus location "@effect/printer/DocStream"
*/

@@ -180,6 +161,5 @@ export declare const isFailedStream: <A>(self: DocStream<A>) => self is FailedStream<A>;

* Returns `true` if the specified `DocStream` is a `EmptyStream`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus fluent effect/printer/DocStream isEmptyStream
* @tsplus location "@effect/printer/DocStream"
*/

@@ -189,6 +169,5 @@ export declare const isEmptyStream: <A>(self: DocStream<A>) => self is EmptyStream<A>;

* Returns `true` if the specified `DocStream` is a `CharStream`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus fluent effect/printer/DocStream isCharStream
* @tsplus location "@effect/printer/DocStream"
*/

@@ -198,6 +177,5 @@ export declare const isCharStream: <A>(self: DocStream<A>) => self is CharStream<A>;

* Returns `true` if the specified `DocStream` is a `TextStream`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus fluent effect/printer/DocStream isTextStream
* @tsplus location "@effect/printer/DocStream"
*/

@@ -207,6 +185,5 @@ export declare const isTextStream: <A>(self: DocStream<A>) => self is TextStream<A>;

* Returns `true` if the specified `DocStream` is a `LineStream`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus fluent effect/printer/DocStream isLineStream
* @tsplus location "@effect/printer/DocStream"
*/

@@ -216,6 +193,5 @@ export declare const isLineStream: <A>(self: DocStream<A>) => self is LineStream<A>;

* Returns `true` if the specified `DocStream` is a `PushAnnotationStream`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus fluent effect/printer/DocStream isPushAnnotationStream
* @tsplus location "@effect/printer/DocStream"
*/

@@ -225,63 +201,52 @@ export declare const isPushAnnotationStream: <A>(self: DocStream<A>) => self is PushAnnotationStream<A>;

* Returns `true` if the specified `DocStream` is a `PopAnnotationStream`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus fluent effect/printer/DocStream isPopAnnotationStream
* @tsplus location "@effect/printer/DocStream"
*/
export declare const isPopAnnotationStream: <A>(self: DocStream<A>) => self is PopAnnotationStream<A>;
/**
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/DocStream.Ops failed
* @tsplus location "@effect/printer/DocStream"
*/
export declare const failed: DocStream<never>;
/**
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/DocStream.Ops empty
* @tsplus location "@effect/printer/DocStream"
*/
export declare const empty: DocStream<never>;
/**
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/DocStream.Ops char
* @tsplus static effect/printer/DocStream.Aspects char
* @tsplus pipeable effect/printer/DocStream char
* @tsplus location "@effect/printer/DocStream"
*/
export declare const char: (char: string) => <A>(self: DocStream<A>) => DocStream<A>;
export declare const char: {
(char: string): <A>(self: DocStream<A>) => DocStream<A>;
<A>(self: DocStream<A>, char: string): DocStream<A>;
};
/**
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/DocStream.Ops text
* @tsplus static effect/printer/DocStream.Aspects text
* @tsplus pipeable effect/printer/DocStream text
* @tsplus location "@effect/printer/DocStream"
*/
export declare const text: (text: string) => <A>(stream: DocStream<A>) => DocStream<A>;
export declare const text: {
(text: string): <A>(self: DocStream<A>) => DocStream<A>;
<A>(self: DocStream<A>, text: string): DocStream<A>;
};
/**
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/DocStream.Ops line
* @tsplus static effect/printer/DocStream.Aspects line
* @tsplus pipeable effect/printer/DocStream line
* @tsplus location "@effect/printer/DocStream"
*/
export declare const line: (indentation: number) => <A>(stream: DocStream<A>) => DocStream<A>;
export declare const line: {
(indentation: number): <A>(self: DocStream<A>) => DocStream<A>;
<A>(self: DocStream<A>, indentation: number): DocStream<A>;
};
/**
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/DocStream.Ops pushAnnotation
* @tsplus static effect/printer/DocStream.Aspects pushAnnotation
* @tsplus pipeable effect/printer/DocStream pushAnnotation
* @tsplus location "@effect/printer/DocStream"
*/
export declare const pushAnnotation: <B>(annotation: B) => <A>(stream: DocStream<B>) => DocStream<A | B>;
export declare const pushAnnotation: {
<B>(annotation: B): <A>(self: DocStream<A>) => DocStream<B | A>;
<A, B>(self: DocStream<A>, annotation: B): DocStream<A | B>;
};
/**
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/DocStream.Ops popAnnotation
* @tsplus location "@effect/printer/DocStream"
*/

@@ -292,61 +257,77 @@ export declare const popAnnotation: <A>(stream: DocStream<A>) => DocStream<A>;

* none at all.
*
* @since 1.0.0
* @category annotations
* @since 1.0.0
* @tsplus static effect/printer/DocStream.Aspects alterAnnotations
* @tsplus pipeable effect/printer/DocStream alterAnnotations
* @tsplus location "@effect/printer/DocStream"
*/
export declare const alterAnnotations: <A, B>(f: (a: A) => Option<B>) => (self: DocStream<A>) => DocStream<B>;
export declare const alterAnnotations: {
<A, B>(f: (a: A) => Option<B>): (self: DocStream<A>) => DocStream<B>;
<A, B>(self: DocStream<A>, f: (a: A) => Option<B>): DocStream<B>;
};
/**
* Modify the annotations of a document.
*
* @since 1.0.0
* @category annotations
* @since 1.0.0
* @tsplus static effect/printer/DocStream.Aspects map
* @tsplus pipeable effect/printer/DocStream map
* @tsplus static effect/printer/DocStream.Aspects reAnnotate
* @tsplus pipeable effect/printer/DocStream reAnnotate
* @tsplus location "@effect/printer/DocStream"
*/
export declare const reAnnotate: <A, B>(f: (a: A) => B) => (self: DocStream<A>) => DocStream<B>;
export declare const reAnnotate: {
<A, B>(f: (a: A) => B): (self: DocStream<A>) => DocStream<B>;
<A, B>(self: DocStream<A>, f: (a: A) => B): DocStream<B>;
};
/**
* Remove all annotations from a document.
*
* @since 1.0.0
* @category annotations
* @since 1.0.0
* @tsplus static effect/printer/DocStream.Ops unAnnotate
* @tsplus getter effect/printer/DocStream unAnnotate
* @tsplus location "@effect/printer/DocStream"
*/
export declare const unAnnotate: <A>(self: DocStream<A>) => DocStream<never>;
/**
* @since 1.0.0
* @category folding
*/
export declare const foldMap: {
<A, M>(M: monoid.Monoid<M>, f: (a: A) => M): (self: DocStream<A>) => M;
<A, M>(self: DocStream<A>, M: monoid.Monoid<M>, f: (a: A) => M): M;
};
/**
* @since 1.0.0
* @tsplus static effect/printer/DocStream.Aspects foldMap
* @tsplus pipeable effect/printer/DocStream foldMap
* @tsplus location "@effect/printer/DocStream"
* @category folding
*/
export declare const foldMap: <A, M>(M: Monoid<M>, f: (a: A) => M) => (self: DocStream<A>) => M;
export declare const match: {
<A, R>(patterns: {
readonly FailedStream: () => R;
readonly EmptyStream: () => R;
readonly CharStream: (char: string, stream: DocStream<A>) => R;
readonly TextStream: (text: string, stream: DocStream<A>) => R;
readonly LineStream: (indentation: number, stream: DocStream<A>) => R;
readonly PushAnnotationStream: (annotation: A, stream: DocStream<A>) => R;
readonly PopAnnotationStream: (stream: DocStream<A>) => R;
}): (self: DocStream<A>) => R;
<A, R>(self: DocStream<A>, patterns: {
readonly FailedStream: () => R;
readonly EmptyStream: () => R;
readonly CharStream: (char: string, stream: DocStream<A>) => R;
readonly TextStream: (text: string, stream: DocStream<A>) => R;
readonly LineStream: (indentation: number, stream: DocStream<A>) => R;
readonly PushAnnotationStream: (annotation: A, stream: DocStream<A>) => R;
readonly PopAnnotationStream: (stream: DocStream<A>) => R;
}): R;
};
/**
* @category folding
* @since 1.0.0
* @tsplus static effect/printer/DocStream.Aspects match
* @tsplus pipeable effect/printer/DocStream match
* @tsplus location "@effect/printer/DocStream"
* @category mapping
*/
export declare const match: <A, R>(patterns: {
readonly FailedStream: () => R;
readonly EmptyStream: () => R;
readonly CharStream: (char: string, stream: DocStream<A>) => R;
readonly TextStream: (text: string, stream: DocStream<A>) => R;
readonly LineStream: (indentation: number, stream: DocStream<A>) => R;
readonly PushAnnotationStream: (annotation: A, stream: DocStream<A>) => R;
readonly PopAnnotationStream: (stream: DocStream<A>) => R;
}) => (self: DocStream<A>) => R;
export declare const map: {
<A, B>(f: (a: A) => B): (self: DocStream<A>) => DocStream<B>;
<A, B>(self: DocStream<A>, f: (a: A) => B): DocStream<B>;
};
/**
* @since 1.0.0
* @category instances
*/
export declare const Functor: covariant.Covariant<DocStreamTypeLambda>;
/**
* @since 1.0.0
* @tsplus static effect/printer/DocStream.Ops Functor
* @tsplus location "@effect/printer/DocStream"
* @category instances
*/
export declare const Functor: _Functor<DocStream.TypeLambda>;
export {};
export declare const Invariant: invariant.Invariant<DocStreamTypeLambda>;
//# sourceMappingURL=DocStream.d.ts.map

@@ -6,4 +6,4 @@ "use strict";

});
exports.unAnnotate = exports.text = exports.reAnnotate = exports.pushAnnotation = exports.popAnnotation = exports.match = exports.line = exports.isTextStream = exports.isPushAnnotationStream = exports.isPopAnnotationStream = exports.isLineStream = exports.isFailedStream = exports.isEmptyStream = exports.isDocStream = exports.isCharStream = exports.foldMap = exports.failed = exports.empty = exports.char = exports.alterAnnotations = exports.Functor = exports.DocStream = void 0;
var DS = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/printer/internal/DocStream"));
exports.unAnnotate = exports.text = exports.reAnnotate = exports.pushAnnotation = exports.popAnnotation = exports.match = exports.map = exports.line = exports.isTextStream = exports.isPushAnnotationStream = exports.isPopAnnotationStream = exports.isLineStream = exports.isFailedStream = exports.isEmptyStream = exports.isDocStream = exports.isCharStream = exports.foldMap = exports.failed = exports.empty = exports.char = exports.alterAnnotations = exports.Invariant = exports.Functor = exports.DocStreamTypeId = void 0;
var internal = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/printer/internal_effect_untraced/docStream"));
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

@@ -18,10 +18,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// -----------------------------------------------------------------------------
const TypeId = DS.DocStreamTypeId;
/**
* @category instances
* @since 1.0.0
* @category symbol
*/
const DocStream = {
$: {}
};
const DocStreamTypeId = internal.DocStreamTypeId;
// -----------------------------------------------------------------------------

@@ -33,71 +30,63 @@ // Refinements

*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus static effect/printer/DocStream.Ops isDocStream
*/
exports.DocStream = DocStream;
const isDocStream = DS.isDocStream;
exports.DocStreamTypeId = DocStreamTypeId;
const isDocStream = internal.isDocStream;
/**
* Returns `true` if the specified `DocStream` is a `FailedStream`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus fluent effect/printer/DocStream isFailedStream
*/
exports.isDocStream = isDocStream;
const isFailedStream = DS.isFailedStream;
const isFailedStream = internal.isFailedStream;
/**
* Returns `true` if the specified `DocStream` is a `EmptyStream`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus fluent effect/printer/DocStream isEmptyStream
*/
exports.isFailedStream = isFailedStream;
const isEmptyStream = DS.isEmptyStream;
const isEmptyStream = internal.isEmptyStream;
/**
* Returns `true` if the specified `DocStream` is a `CharStream`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus fluent effect/printer/DocStream isCharStream
*/
exports.isEmptyStream = isEmptyStream;
const isCharStream = DS.isCharStream;
const isCharStream = internal.isCharStream;
/**
* Returns `true` if the specified `DocStream` is a `TextStream`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus fluent effect/printer/DocStream isTextStream
*/
exports.isCharStream = isCharStream;
const isTextStream = DS.isTextStream;
const isTextStream = internal.isTextStream;
/**
* Returns `true` if the specified `DocStream` is a `LineStream`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus fluent effect/printer/DocStream isLineStream
*/
exports.isTextStream = isTextStream;
const isLineStream = DS.isLineStream;
const isLineStream = internal.isLineStream;
/**
* Returns `true` if the specified `DocStream` is a `PushAnnotationStream`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus fluent effect/printer/DocStream isPushAnnotationStream
*/
exports.isLineStream = isLineStream;
const isPushAnnotationStream = DS.isPushAnnotationStream;
const isPushAnnotationStream = internal.isPushAnnotationStream;
/**
* Returns `true` if the specified `DocStream` is a `PopAnnotationStream`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus fluent effect/printer/DocStream isPopAnnotationStream
*/
exports.isPushAnnotationStream = isPushAnnotationStream;
const isPopAnnotationStream = DS.isPopAnnotationStream;
const isPopAnnotationStream = internal.isPopAnnotationStream;
// -----------------------------------------------------------------------------

@@ -107,58 +96,43 @@ // Constructors

/**
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/DocStream.Ops failed
*/
exports.isPopAnnotationStream = isPopAnnotationStream;
const failed = DS.failed;
const failed = internal.failed;
/**
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/DocStream.Ops empty
*/
exports.failed = failed;
const empty = DS.empty;
const empty = internal.empty;
/**
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/DocStream.Ops char
* @tsplus static effect/printer/DocStream.Aspects char
* @tsplus pipeable effect/printer/DocStream char
*/
exports.empty = empty;
const char = DS.char;
const char = internal.char;
/**
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/DocStream.Ops text
* @tsplus static effect/printer/DocStream.Aspects text
* @tsplus pipeable effect/printer/DocStream text
*/
exports.char = char;
const text = DS.text;
const text = internal.text;
/**
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/DocStream.Ops line
* @tsplus static effect/printer/DocStream.Aspects line
* @tsplus pipeable effect/printer/DocStream line
*/
exports.text = text;
const line = DS.line;
const line = internal.line;
/**
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/DocStream.Ops pushAnnotation
* @tsplus static effect/printer/DocStream.Aspects pushAnnotation
* @tsplus pipeable effect/printer/DocStream pushAnnotation
*/
exports.line = line;
const pushAnnotation = DS.pushAnnotation;
const pushAnnotation = internal.pushAnnotation;
/**
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/DocStream.Ops popAnnotation
*/
exports.pushAnnotation = pushAnnotation;
const popAnnotation = DS.popAnnotation;
const popAnnotation = internal.popAnnotation;
// -----------------------------------------------------------------------------

@@ -171,31 +145,23 @@ // Annotations

*
* @since 1.0.0
* @category annotations
* @since 1.0.0
* @tsplus static effect/printer/DocStream.Aspects alterAnnotations
* @tsplus pipeable effect/printer/DocStream alterAnnotations
*/
exports.popAnnotation = popAnnotation;
const alterAnnotations = DS.alterAnnotations;
const alterAnnotations = internal.alterAnnotations;
/**
* Modify the annotations of a document.
*
* @since 1.0.0
* @category annotations
* @since 1.0.0
* @tsplus static effect/printer/DocStream.Aspects map
* @tsplus pipeable effect/printer/DocStream map
* @tsplus static effect/printer/DocStream.Aspects reAnnotate
* @tsplus pipeable effect/printer/DocStream reAnnotate
*/
exports.alterAnnotations = alterAnnotations;
const reAnnotate = DS.reAnnotate;
const reAnnotate = internal.reAnnotate;
/**
* Remove all annotations from a document.
*
* @since 1.0.0
* @category annotations
* @since 1.0.0
* @tsplus static effect/printer/DocStream.Ops unAnnotate
* @tsplus getter effect/printer/DocStream unAnnotate
*/
exports.reAnnotate = reAnnotate;
const unAnnotate = DS.unAnnotate;
const unAnnotate = internal.unAnnotate;
// -----------------------------------------------------------------------------

@@ -205,25 +171,32 @@ // Annotations

/**
* @since 1.0.0
* @category folding
* @since 1.0.0
* @tsplus static effect/printer/DocStream.Aspects foldMap
* @tsplus pipeable effect/printer/DocStream foldMap
*/
exports.unAnnotate = unAnnotate;
const foldMap = DS.foldMap;
const foldMap = internal.foldMap;
/**
* @since 1.0.0
* @category folding
* @since 1.0.0
* @tsplus static effect/printer/DocStream.Aspects match
* @tsplus pipeable effect/printer/DocStream match
*/
exports.foldMap = foldMap;
const match = DS.match;
const match = internal.match;
/**
* @since 1.0.0
* @category mapping
*/
exports.match = match;
const map = internal.map;
/**
* @since 1.0.0
* @category instances
*/
exports.map = map;
const Functor = internal.Covariant;
/**
* @since 1.0.0
* @tsplus static effect/printer/DocStream.Ops Functor
* @category instances
*/
exports.match = match;
const Functor = DS.Functor;
exports.Functor = Functor;
const Invariant = internal.Invariant;
exports.Invariant = Invariant;
//# sourceMappingURL=DocStream.js.map
/**
* @since 1.0.0
*/
import { DocStream } from "@effect/printer/DocStream";
import * as DT from "@effect/printer/internal/DocTree";
import type { TypeLambda } from "@fp-ts/core/HKT";
import type { Covariant as _Functor } from "@fp-ts/core/typeclass/Covariant";
import type { Monoid } from "@fp-ts/core/typeclass/Monoid";
import type { Semigroup } from "@fp-ts/core/typeclass/Semigroup";
import type { Chunk } from "@fp-ts/data/Chunk";
declare const TypeId: unique symbol;
import type { Chunk } from "@effect/data/Chunk";
import type { Equal } from "@effect/data/Equal";
import type { TypeLambda } from "@effect/data/HKT";
import type * as covariant from "@effect/data/typeclass/Covariant";
import type * as invariant from "@effect/data/typeclass/Invariant";
import type * as monoid from "@effect/data/typeclass/Monoid";
import type * as semigroup from "@effect/data/typeclass/Semigroup";
import type * as DocStream from "@effect/printer/DocStream";
/**
* @since 1.0.0
* @category symbol
*/
export declare const DocTreeTypeId: unique symbol;
/**
* @since 1.0.0
* @category symbol
*/
export type TypeId = typeof TypeId;
export type DocTreeTypeId = typeof DocTreeTypeId;
/**

@@ -29,23 +34,21 @@ * Represents a document that has been laid out into a tree-like structure.

*
* @since 1.0.0
* @category model
* @since 1.0.0
* @tsplus type effect/printer/DocTree
*/
export type DocTree<A> = EmptyTree<A> | CharTree<A> | TextTree<A> | LineTree<A> | AnnotationTree<A> | ConcatTree<A>;
export declare namespace DocTree {
type TypeLambda = DocTreeTypeLambda;
}
/**
* @category model
* @since 1.0.0
* @tsplus type effect/printer/DocTree.Ops
*/
export interface DocTreeOps {
$: DocTreeAspects;
export declare namespace DocTree {
interface Variance<A> extends Equal {
readonly [DocTreeTypeId]: {
readonly _A: (_: never) => A;
};
}
type TypeLambda = DocTreeTypeLambda;
}
/**
* @category instances
* @since 1.0.0
* @category model
*/
export declare const DocTree: DocTreeOps;
export interface DocTreeTypeLambda extends TypeLambda {

@@ -55,55 +58,38 @@ readonly type: DocTree<this["Target"]>;

/**
* @category model
* @since 1.0.0
* @tsplus type effect/printer/DocTree.Aspects
*/
export interface DocTreeAspects {
}
/**
* @category model
* @since 1.0.0
*/
export interface EmptyTree<A> {
export interface EmptyTree<A> extends DocTree.Variance<A> {
readonly _tag: "EmptyTree";
readonly _id: TypeId;
readonly _A: (_: never) => A;
}
/**
* @since 1.0.0
* @category model
* @since 1.0.0
*/
export interface CharTree<A> {
export interface CharTree<A> extends DocTree.Variance<A> {
readonly _tag: "CharTree";
readonly _id: TypeId;
readonly _A: (_: never) => A;
readonly char: string;
}
/**
* @since 1.0.0
* @category model
* @since 1.0.0
*/
export interface TextTree<A> {
export interface TextTree<A> extends DocTree.Variance<A> {
readonly _tag: "TextTree";
readonly _id: TypeId;
readonly _A: (_: never) => A;
readonly text: string;
}
/**
* @since 1.0.0
* @category model
* @since 1.0.0
*/
export interface LineTree<A> {
export interface LineTree<A> extends DocTree.Variance<A> {
readonly _tag: "LineTree";
readonly _id: TypeId;
readonly _A: (_: never) => A;
readonly indentation: number;
}
/**
* @since 1.0.0
* @category model
* @since 1.0.0
*/
export interface AnnotationTree<A> {
export interface AnnotationTree<A> extends DocTree.Variance<A> {
readonly _tag: "AnnotationTree";
readonly _id: TypeId;
readonly _A: (_: never) => A;
readonly annotation: A;

@@ -113,9 +99,7 @@ readonly tree: DocTree<A>;

/**
* @since 1.0.0
* @category model
* @since 1.0.0
*/
export interface ConcatTree<A> {
export interface ConcatTree<A> extends DocTree.Variance<A> {
readonly _tag: "ConcatTree";
readonly _id: TypeId;
readonly _A: (_: never) => A;
readonly trees: Chunk<DocTree<A>>;

@@ -125,6 +109,5 @@ }

* Returns `true` if the specified value is a `DocTree`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus static effect/printer/DocTree.Ops isDocTree
* @tsplus location "@effect/printer/DocTree"
*/

@@ -134,6 +117,5 @@ export declare const isDocTree: (u: unknown) => u is DocTree<unknown>;

* Returns `true` if the specified `DocTree` is an `EmptyTree`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus fluent effect/printer/DocTree isEmptyTree
* @tsplus location "@effect/printer/DocTree"
*/

@@ -143,6 +125,5 @@ export declare const isEmptyTree: <A>(self: DocTree<A>) => self is EmptyTree<A>;

* Returns `true` if the specified `DocTree` is an `CharTree`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus fluent effect/printer/DocTree isCharTree
* @tsplus location "@effect/printer/DocTree"
*/

@@ -152,58 +133,46 @@ export declare const isCharTree: <A>(self: DocTree<A>) => self is CharTree<A>;

* Returns `true` if the specified `DocTree` is an `TextTree`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus fluent effect/printer/DocTree isTextTree
* @tsplus location "@effect/printer/DocTree"
*/
export declare const isTextTree: <A>(self: DocTree<A>) => self is DT.TextTree<A>;
export declare const isTextTree: <A>(self: DocTree<A>) => self is TextTree<A>;
/**
* Returns `true` if the specified `DocTree` is an `LineTree`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus fluent effect/printer/DocTree isLineTree
* @tsplus location "@effect/printer/DocTree"
*/
export declare const isLineTree: <A>(self: DocTree<A>) => self is DT.LineTree<A>;
export declare const isLineTree: <A>(self: DocTree<A>) => self is LineTree<A>;
/**
* Returns `true` if the specified `DocTree` is an `AnnotationTree`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus fluent effect/printer/DocTree isAnnotationTree
* @tsplus location "@effect/printer/DocTree"
*/
export declare const isAnnotationTree: <A>(self: DocTree<A>) => self is DT.AnnotationTree<A>;
export declare const isAnnotationTree: <A>(self: DocTree<A>) => self is AnnotationTree<A>;
/**
* Returns `true` if the specified `DocTree` is an `ConcatTree`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus fluent effect/printer/DocTree isConcatTree
* @tsplus location "@effect/printer/DocTree"
*/
export declare const isConcatTree: <A>(self: DocTree<A>) => self is DT.ConcatTree<A>;
export declare const isConcatTree: <A>(self: DocTree<A>) => self is ConcatTree<A>;
/**
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/DocTree.Ops empty
* @tsplus location "@effect/printer/DocTree"
*/
export declare const empty: DocTree<never>;
/**
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/DocTree.Ops char
* @tsplus location "@effect/printer/DocTree"
*/
export declare const char: <A>(char: string) => DocTree<A>;
/**
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/DocTree.Ops text
* @tsplus location "@effect/printer/DocTree"
*/
export declare const text: <A>(text: string) => DocTree<A>;
/**
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/DocTree.Ops line
* @tsplus location "@effect/printer/DocTree"
*/

@@ -213,14 +182,15 @@ export declare const line: <A>(indentation: number) => DocTree<A>;

* Annotate the specified `DocTree` with an annotation of type `A`.
*
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/DocTree.Ops annotation
* @tsplus location "@effect/printer/DocTree"
*/
export declare const annotation: <A>(annotation: A) => (self: DocTree<A>) => DocTree<A>;
export declare const annotation: {
<A>(annotation: A): <B>(self: DocTree<B>) => DocTree<A | B>;
<A, B>(self: DocTree<A>, annotation: B): DocTree<A | B>;
};
/**
* Horizontally concatenates multiple `DocTree`s.
*
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/DocTree.Ops concat
* @tsplus location "@effect/printer/DocTree"
*/

@@ -231,37 +201,35 @@ export declare const concat: <A>(trees: Chunk<DocTree<A>>) => DocTree<A>;

* all.
*
* @since 1.0.0
* @category annotations
* @since 1.0.0
* @tsplus static effect/printer/DocTree.Aspects alterAnnotations
* @tsplus pipeable effect/printer/DocTree alterAnnotations
* @tsplus location "@effect/printer/DocTree"
*/
export declare const alterAnnotations: <A, B>(f: (a: A) => Iterable<B>) => (self: DocTree<A>) => DocTree<B>;
export declare const alterAnnotations: {
<A, B>(f: (a: A) => Iterable<B>): (self: DocTree<A>) => DocTree<B>;
<A, B>(self: DocTree<A>, f: (a: A) => Iterable<B>): DocTree<B>;
};
/**
* Change the annotation of a `DocTree`.
*
* @since 1.0.0
* @category annotations
* @since 1.0.0
* @tsplus static effect/printer/DocTree.Aspects map
* @tsplus pipeable effect/printer/DocTree map
* @tsplus static effect/printer/DocTree.Aspects reAnnotate
* @tsplus pipeable effect/printer/DocTree reAnnotate
* @tsplus location "@effect/printer/DocTree"
*/
export declare const reAnnotate: <A, B>(f: (a: A) => B) => (self: DocTree<A>) => DocTree<B>;
export declare const reAnnotate: {
<A, B>(f: (a: A) => B): (self: DocTree<A>) => DocTree<B>;
<A, B>(self: DocTree<A>, f: (a: A) => B): DocTree<B>;
};
/**
* Remove all annotations from a `DocTree`.
*
* @since 1.0.0
* @category annotations
* @since 1.0.0
* @tsplus static effect/printer/DocTree.Aspects unAnnotate
* @tsplus getter effect/printer/DocTree unAnnotate
* @tsplus location "@effect/printer/DocTree"
*/
export declare const unAnnotate: <A>(self: DocTree<A>) => DocTree<never>;
/**
* @since 1.0.0
* @category folding
* @since 1.0.0
* @tsplus static effect/printer/DocTree.Aspects foldMap
* @tsplus pipeable effect/printer/DocTree foldMap
* @tsplus location "@effect/printer/DocTree"
*/
export declare const foldMap: <A, M>(I: Monoid<M>, f: (a: A) => M) => (self: DocTree<A>) => M;
export declare const foldMap: {
<A, M>(M: monoid.Monoid<M>, f: (a: A) => M): (self: DocTree<A>) => M;
<A, M>(self: DocTree<A>, M: monoid.Monoid<M>, f: (a: A) => M): M;
};
/**

@@ -272,37 +240,41 @@ * The simplest possible tree-based renderer.

* to surround annotated regions with »>>>« and »<<<«.
* @example import * as Doc from "@effect/printer/Doc"
import * as DocTree from "@effect/printer/DocTree"
import * as Layout from "@effect/printer/Layout"
import { identity, pipe } from "@fp-ts/data/Function"
import * as String from "@fp-ts/data/String"
const doc: Doc.Doc<void> = Doc.hsep([
Doc.text("hello"),
pipe(
Doc.text("world"),
Doc.annotate(undefined),
Doc.cat(Doc.char("!"))
)
])
const tree = DocTree.treeForm(Layout.pretty(Layout.defaultLayoutOptions)(doc))
const rendered = pipe(
tree,
DocTree.renderSimplyDecorated(String.Monoid, identity, (_, x) => `>>>${x}<<<`)
)
assert.strictEqual(
rendered,
"hello >>>world<<<!"
)
*
* @example
* import * as Doc from "@effect/printer/Doc"
* import * as DocTree from "@effect/printer/DocTree"
* import * as Layout from "@effect/printer/Layout"
* import { identity, pipe } from "@effect/data/Function"
* import * as String from "@effect/data/String"
*
* const doc: Doc.Doc<void> = Doc.hsep([
* Doc.text("hello"),
* pipe(
* Doc.text("world"),
* Doc.annotate(undefined),
* Doc.cat(Doc.char("!"))
* )
* ])
*
* const tree = DocTree.treeForm(Layout.pretty(Layout.defaultLayoutOptions)(doc))
*
* const rendered = pipe(
* tree,
* DocTree.renderSimplyDecorated(String.Monoid, identity, (_, x) => `>>>${x}<<<`)
* )
*
* assert.strictEqual(
* rendered,
* "hello >>>world<<<!"
* )
*
* @since 1.0.0
* @category rendering
* @since 1.0.0
* @tsplus static effect/printer/DocTree.Aspects renderSimplyDecorated
* @tsplus pipeable effect/printer/DocTree renderSimplyDecorated
* @tsplus location "@effect/printer/DocTree"
*/
export declare const renderSimplyDecorated: <A, M>(M: Monoid<M>, renderText: (text: string) => M, renderAnnotation: (annotation: A, out: M) => M) => (self: DocTree<A>) => M;
export declare const renderSimplyDecorated: {
<A, M>(M: monoid.Monoid<M>, renderText: (text: string) => M, renderAnnotation: (annotation: A, out: M) => M): (self: DocTree<A>) => M;
<A, M>(self: DocTree<A>, M: monoid.Monoid<M>, renderText: (text: string) => M, renderAnnotation: (annotation: A, out: M) => M): M;
};
/**
* Converts a `DocStream<A>` into a `DocTree<A>`.
*
* @category conversions

@@ -312,27 +284,24 @@ * @since 1.0.0

* @tsplus getter effect/printer/DocStream treeForm
* @tsplus location "@effect/printer/DocTree"
*/
export declare const treeForm: <A>(stream: DocStream<A>) => DocTree<A>;
export declare const treeForm: <A>(stream: DocStream.DocStream<A>) => DocTree<A>;
/**
* @since 1.0.0
* @category instances
*/
export declare const getSemigroup: <A>(_: void) => semigroup.Semigroup<DocTree<A>>;
/**
* @since 1.0.0
* @tsplus static effect/printer/DocTree.Ops getSemigroup
* @tsplus location "@effect/printer/DocTree"
* @category instances
*/
export declare const getSemigroup: <A>() => Semigroup<DocTree<A>>;
export declare const getMonoid: <A>(_: void) => monoid.Monoid<DocTree<A>>;
/**
* @since 1.0.0
* @category instances
* @since 1.0.0
* @tsplus static effect/printer/DocTree.Ops getMonoid
* @tsplus location "@effect/printer/DocTree"
*/
export declare const getMonoid: <A>() => Monoid<DocTree<A>>;
export declare const Covariant: covariant.Covariant<DocTree.TypeLambda>;
/**
* @since 1.0.0
* @category instances
* @since 1.0.0
* @tsplus static effect/printer/DocTree.Ops Covariant
* @tsplus location "@effect/printer/DocTree"
*/
export declare const Functor: _Functor<DocTree.TypeLambda>;
export {};
export declare const Invariant: invariant.Invariant<DocTree.TypeLambda>;
//# sourceMappingURL=DocTree.d.ts.map

@@ -6,4 +6,4 @@ "use strict";

});
exports.unAnnotate = exports.treeForm = exports.text = exports.renderSimplyDecorated = exports.reAnnotate = exports.line = exports.isTextTree = exports.isLineTree = exports.isEmptyTree = exports.isDocTree = exports.isConcatTree = exports.isCharTree = exports.isAnnotationTree = exports.getSemigroup = exports.getMonoid = exports.foldMap = exports.empty = exports.concat = exports.char = exports.annotation = exports.alterAnnotations = exports.Functor = exports.DocTree = void 0;
var DT = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/printer/internal/DocTree"));
exports.unAnnotate = exports.treeForm = exports.text = exports.renderSimplyDecorated = exports.reAnnotate = exports.line = exports.isTextTree = exports.isLineTree = exports.isEmptyTree = exports.isDocTree = exports.isConcatTree = exports.isCharTree = exports.isAnnotationTree = exports.getSemigroup = exports.getMonoid = exports.foldMap = exports.empty = exports.concat = exports.char = exports.annotation = exports.alterAnnotations = exports.Invariant = exports.DocTreeTypeId = exports.Covariant = void 0;
var internal = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/printer/internal_effect_untraced/docTree"));
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

@@ -18,10 +18,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// -----------------------------------------------------------------------------
const TypeId = DT.DocTreeTypeId;
/**
* @category instances
* @since 1.0.0
* @category symbol
*/
const DocTree = {
$: {}
};
const DocTreeTypeId = internal.DocTreeTypeId;
// -----------------------------------------------------------------------------

@@ -33,62 +30,55 @@ // Refinements

*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus static effect/printer/DocTree.Ops isDocTree
*/
exports.DocTree = DocTree;
const isDocTree = DT.isDocTree;
exports.DocTreeTypeId = DocTreeTypeId;
const isDocTree = internal.isDocTree;
/**
* Returns `true` if the specified `DocTree` is an `EmptyTree`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus fluent effect/printer/DocTree isEmptyTree
*/
exports.isDocTree = isDocTree;
const isEmptyTree = DT.isEmptyTree;
const isEmptyTree = internal.isEmptyTree;
/**
* Returns `true` if the specified `DocTree` is an `CharTree`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus fluent effect/printer/DocTree isCharTree
*/
exports.isEmptyTree = isEmptyTree;
const isCharTree = DT.isCharTree;
const isCharTree = internal.isCharTree;
/**
* Returns `true` if the specified `DocTree` is an `TextTree`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus fluent effect/printer/DocTree isTextTree
*/
exports.isCharTree = isCharTree;
const isTextTree = DT.isTextTree;
const isTextTree = internal.isTextTree;
/**
* Returns `true` if the specified `DocTree` is an `LineTree`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus fluent effect/printer/DocTree isLineTree
*/
exports.isTextTree = isTextTree;
const isLineTree = DT.isLineTree;
const isLineTree = internal.isLineTree;
/**
* Returns `true` if the specified `DocTree` is an `AnnotationTree`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus fluent effect/printer/DocTree isAnnotationTree
*/
exports.isLineTree = isLineTree;
const isAnnotationTree = DT.isAnnotationTree;
const isAnnotationTree = internal.isAnnotationTree;
/**
* Returns `true` if the specified `DocTree` is an `ConcatTree`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus fluent effect/printer/DocTree isConcatTree
*/
exports.isAnnotationTree = isAnnotationTree;
const isConcatTree = DT.isConcatTree;
const isConcatTree = internal.isConcatTree;
// -----------------------------------------------------------------------------

@@ -98,47 +88,41 @@ // Constructors

/**
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/DocTree.Ops empty
*/
exports.isConcatTree = isConcatTree;
const empty = DT.empty;
const empty = internal.empty;
/**
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/DocTree.Ops char
*/
exports.empty = empty;
const char = DT.char;
const char = internal.char;
/**
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/DocTree.Ops text
*/
exports.char = char;
const text = DT.text;
const text = internal.text;
/**
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/DocTree.Ops line
*/
exports.text = text;
const line = DT.line;
const line = internal.line;
/**
* Annotate the specified `DocTree` with an annotation of type `A`.
*
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/DocTree.Ops annotation
*/
exports.line = line;
const annotation = DT.annotation;
const annotation = internal.annotation;
/**
* Horizontally concatenates multiple `DocTree`s.
*
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/DocTree.Ops concat
*/
exports.annotation = annotation;
const concat = DT.concat;
const concat = internal.concat;
// -----------------------------------------------------------------------------

@@ -151,31 +135,23 @@ // Annotations

*
* @since 1.0.0
* @category annotations
* @since 1.0.0
* @tsplus static effect/printer/DocTree.Aspects alterAnnotations
* @tsplus pipeable effect/printer/DocTree alterAnnotations
*/
exports.concat = concat;
const alterAnnotations = DT.alterAnnotations;
const alterAnnotations = internal.alterAnnotations;
/**
* Change the annotation of a `DocTree`.
*
* @since 1.0.0
* @category annotations
* @since 1.0.0
* @tsplus static effect/printer/DocTree.Aspects map
* @tsplus pipeable effect/printer/DocTree map
* @tsplus static effect/printer/DocTree.Aspects reAnnotate
* @tsplus pipeable effect/printer/DocTree reAnnotate
*/
exports.alterAnnotations = alterAnnotations;
const reAnnotate = DT.reAnnotate;
const reAnnotate = internal.reAnnotate;
/**
* Remove all annotations from a `DocTree`.
*
* @since 1.0.0
* @category annotations
* @since 1.0.0
* @tsplus static effect/printer/DocTree.Aspects unAnnotate
* @tsplus getter effect/printer/DocTree unAnnotate
*/
exports.reAnnotate = reAnnotate;
const unAnnotate = DT.unAnnotate;
const unAnnotate = internal.unAnnotate;
// -----------------------------------------------------------------------------

@@ -185,9 +161,7 @@ // Folding

/**
* @since 1.0.0
* @category folding
* @since 1.0.0
* @tsplus static effect/printer/DocTree.Aspects foldMap
* @tsplus pipeable effect/printer/DocTree foldMap
*/
exports.unAnnotate = unAnnotate;
const foldMap = DT.foldMap;
const foldMap = internal.foldMap;
// -----------------------------------------------------------------------------

@@ -206,4 +180,4 @@ // Instances

* import * as Layout from "@effect/printer/Layout"
* import { identity, pipe } from "@fp-ts/data/Function"
* import * as String from "@fp-ts/data/String"
* import { identity, pipe } from "@effect/data/Function"
* import * as String from "@effect/data/String"
*

@@ -231,9 +205,7 @@ * const doc: Doc.Doc<void> = Doc.hsep([

*
* @since 1.0.0
* @category rendering
* @since 1.0.0
* @tsplus static effect/printer/DocTree.Aspects renderSimplyDecorated
* @tsplus pipeable effect/printer/DocTree renderSimplyDecorated
*/
exports.foldMap = foldMap;
const renderSimplyDecorated = DT.renderSimplyDecorated;
const renderSimplyDecorated = internal.renderSimplyDecorated;
// -----------------------------------------------------------------------------

@@ -251,3 +223,3 @@ // Conversions

exports.renderSimplyDecorated = renderSimplyDecorated;
const treeForm = DT.treeForm;
const treeForm = internal.treeForm;
// -----------------------------------------------------------------------------

@@ -257,23 +229,26 @@ // Instances

/**
* @since 1.0.0
* @category instances
* @since 1.0.0
* @tsplus static effect/printer/DocTree.Ops getSemigroup
*/
exports.treeForm = treeForm;
const getSemigroup = DT.getSemigroup;
const getSemigroup = internal.getSemigroup;
/**
* @since 1.0.0
* @category instances
* @since 1.0.0
* @tsplus static effect/printer/DocTree.Ops getMonoid
*/
exports.getSemigroup = getSemigroup;
const getMonoid = DT.getMonoid;
const getMonoid = internal.getMonoid;
/**
* @since 1.0.0
* @category instances
*/
exports.getMonoid = getMonoid;
const Covariant = internal.Covariant;
/**
* @since 1.0.0
* @tsplus static effect/printer/DocTree.Ops Covariant
* @category instances
*/
exports.getMonoid = getMonoid;
const Functor = DT.Functor;
exports.Functor = Functor;
exports.Covariant = Covariant;
const Invariant = internal.Invariant;
exports.Invariant = Invariant;
//# sourceMappingURL=DocTree.js.map
/**
* @since 1.0.0
*/
import type { TypeLambda } from "@fp-ts/core/HKT";
import type { Covariant as _Functor } from "@fp-ts/core/typeclass/Covariant";
declare const TypeId: unique symbol;
import type { Equal } from "@effect/data/Equal";
import type { TypeLambda } from "@effect/data/HKT";
/**
* @since 1.0.0
* @category symbol
*/
export declare const FlattenTypeId: unique symbol;
/**
* @since 1.0.0
* @category symbol
*/
export type TypeId = typeof TypeId;
export type FlattenTypeId = typeof FlattenTypeId;
/**

@@ -19,5 +23,4 @@ * Because certain documents do not change after removal of newlines, etc, there

*
* @since 1.0.0
* @category model
* @since 1.0.0
* @tsplus type effect/printer/Flatten
*/

@@ -29,20 +32,16 @@ export type Flatten<A> = Flattened<A> | AlreadyFlat<A> | NeverFlat<A>;

export declare namespace Flatten {
/**
* @since 1.0.0
* @category model
*/
interface Variance<A> extends Equal {
readonly [FlattenTypeId]: {
readonly _A: (_: never) => A;
};
}
type TypeLambda = FlattenTypeLambda;
}
/**
* @category model
* @since 1.0.0
* @tsplus type effect/printer/Flatten.Ops
*/
export interface FlattenOps {
$: FlattenAspects;
}
/**
* @category instances
* @since 1.0.0
*/
export declare const Flatten: FlattenOps;
/**
* @category model
* @since 1.0.0
*/

@@ -53,18 +52,9 @@ export interface FlattenTypeLambda extends TypeLambda {

/**
* @category model
* @since 1.0.0
* @tsplus type effect/printer/Flatten.Aspects
*/
export interface FlattenAspects {
}
/**
* Represents a `FlattenResult` where `A` is likely flatter than the input.
*
* @since 1.0.0
* @category model
* @since 1.0.0
*/
export interface Flattened<A> {
export interface Flattened<A> extends Flatten.Variance<A> {
readonly _tag: "Flattened";
readonly _id: TypeId;
readonly _A: (_: never) => A;
readonly value: A;

@@ -75,9 +65,7 @@ }

*
* @since 1.0.0
* @category model
* @since 1.0.0
*/
export interface AlreadyFlat<A> {
export interface AlreadyFlat<A> extends Flatten.Variance<A> {
readonly _tag: "AlreadyFlat";
readonly _id: TypeId;
readonly _A: (_: never) => A;
}

@@ -87,16 +75,13 @@ /**

*
* @since 1.0.0
* @category model
* @since 1.0.0
*/
export interface NeverFlat<A> {
export interface NeverFlat<A> extends Flatten.Variance<A> {
readonly _tag: "NeverFlat";
readonly _id: TypeId;
readonly _A: (_: never) => A;
}
/**
* Returns `true` if the specified value is a `Flatten`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus static effect/printer/Flatten.Ops isFlatten
* @tsplus location "@effect/printer/Flatten"
*/

@@ -106,6 +91,5 @@ export declare const isFlatten: (u: unknown) => u is Flatten<unknown>;

* Returns `true` if the specified `Flatten` is a `Flattened`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus fluent effect/printer/Flatten isFlattened
* @tsplus location "@effect/printer/Flatten"
*/

@@ -115,6 +99,5 @@ export declare const isFlattened: <A>(a: Flatten<A>) => a is Flattened<A>;

* Returns `true` if the specified `Flatten` is an `AlreadyFlat`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus fluent effect/printer/Flatten isAlreadyFlat
* @tsplus location "@effect/printer/Flatten"
*/

@@ -124,57 +107,30 @@ export declare const isAlreadyFlat: <A>(a: Flatten<A>) => a is AlreadyFlat<A>;

* Returns `true` if the specified `Flatten` is a `NeverFlat`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus fluent effect/printer/Flatten isNeverFlat
* @tsplus location "@effect/printer/Flatten"
*/
export declare const isNeverFlat: <A>(a: Flatten<A>) => a is NeverFlat<A>;
/**
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/Flatten.Ops Flattened
* @tsplus location "@effect/printer/Flatten"
*/
export declare const flattened: <A>(value: A) => Flatten<A>;
/**
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/Flatten.Ops AlreadyFlat
* @tsplus location "@effect/printer/Flatten"
*/
export declare const alreadyFlat: Flatten<never>;
/**
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/Flatten.Ops NeverFlat
* @tsplus location "@effect/printer/Flatten"
*/
export declare const neverFlat: Flatten<never>;
/**
* @since 1.0.0
* @category mapping
* @since 1.0.0
* @tsplus static effect/printer/Flatten.Aspects map
* @tsplus pipeable effect/printer/Flatten map
* @tsplus location "@effect/printer/Flatten"
*/
export declare const map: <A, B>(f: (a: A) => B) => (self: Flatten<A>) => Flatten<B>;
/**
* @category folding
* @since 1.0.0
* @tsplus static effect/printer/Flatten.Aspects match
* @tsplus pipeable effect/printer/Flatten match
* @tsplus location "@effect/printer/Flatten"
*/
export declare const match: <A, R>(patterns: {
readonly Flattened: (value: A) => R;
readonly AlreadyFlat: () => R;
readonly NeverFlat: () => R;
}) => (flatten: Flatten<A>) => R;
/**
* @category instances
* @since 1.0.0
* @tsplus static effect/printer/Flatten.Ops Functor
* @tsplus location "@effect/printer/Flatten"
*/
export declare const Functor: _Functor<Flatten.TypeLambda>;
export {};
export declare const map: {
<A, B>(f: (a: A) => B): (self: Flatten<A>) => Flatten<B>;
<A, B>(self: Flatten<A>, f: (a: A) => B): Flatten<B>;
};
//# sourceMappingURL=Flatten.d.ts.map

@@ -6,4 +6,4 @@ "use strict";

});
exports.neverFlat = exports.match = exports.map = exports.isNeverFlat = exports.isFlattened = exports.isFlatten = exports.isAlreadyFlat = exports.flattened = exports.alreadyFlat = exports.Functor = exports.Flatten = void 0;
var F = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/printer/internal/Flatten"));
exports.neverFlat = exports.map = exports.isNeverFlat = exports.isFlattened = exports.isFlatten = exports.isAlreadyFlat = exports.flattened = exports.alreadyFlat = exports.FlattenTypeId = void 0;
var internal = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/printer/internal_effect_untraced/flatten"));
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

@@ -15,13 +15,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// -----------------------------------------------------------------------------
// Models
// -----------------------------------------------------------------------------
const TypeId = F.FlattenTypeId;
/**
* @category instances
* @since 1.0.0
* @category symbol
*/
const Flatten = {
$: {}
};
const FlattenTypeId = internal.FlattenTypeId;
// -----------------------------------------------------------------------------

@@ -33,35 +27,31 @@ // Refinements

*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus static effect/printer/Flatten.Ops isFlatten
*/
exports.Flatten = Flatten;
const isFlatten = F.isFlatten;
exports.FlattenTypeId = FlattenTypeId;
const isFlatten = internal.isFlatten;
/**
* Returns `true` if the specified `Flatten` is a `Flattened`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus fluent effect/printer/Flatten isFlattened
*/
exports.isFlatten = isFlatten;
const isFlattened = F.isFlattened;
const isFlattened = internal.isFlattened;
/**
* Returns `true` if the specified `Flatten` is an `AlreadyFlat`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus fluent effect/printer/Flatten isAlreadyFlat
*/
exports.isFlattened = isFlattened;
const isAlreadyFlat = F.isAlreadyFlat;
const isAlreadyFlat = internal.isAlreadyFlat;
/**
* Returns `true` if the specified `Flatten` is a `NeverFlat`, `false` otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus fluent effect/printer/Flatten isNeverFlat
*/
exports.isAlreadyFlat = isAlreadyFlat;
const isNeverFlat = F.isNeverFlat;
const isNeverFlat = internal.isNeverFlat;
// -----------------------------------------------------------------------------

@@ -71,22 +61,19 @@ // Constructors

/**
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/Flatten.Ops Flattened
*/
exports.isNeverFlat = isNeverFlat;
const flattened = F.flattened;
const flattened = internal.flattened;
/**
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/Flatten.Ops AlreadyFlat
*/
exports.flattened = flattened;
const alreadyFlat = F.alreadyFlat;
const alreadyFlat = internal.alreadyFlat;
/**
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/Flatten.Ops NeverFlat
*/
exports.alreadyFlat = alreadyFlat;
const neverFlat = F.neverFlat;
const neverFlat = internal.neverFlat;
// -----------------------------------------------------------------------------

@@ -96,28 +83,16 @@ // Combinators

/**
* @since 1.0.0
* @category mapping
* @since 1.0.0
* @tsplus static effect/printer/Flatten.Aspects map
* @tsplus pipeable effect/printer/Flatten map
*/
exports.neverFlat = neverFlat;
const map = F.map;
/**
* @category folding
* @since 1.0.0
* @tsplus static effect/printer/Flatten.Aspects match
* @tsplus pipeable effect/printer/Flatten match
*/
exports.map = map;
const match = F.match;
const map = internal.map;
// -----------------------------------------------------------------------------
// Instances
// -----------------------------------------------------------------------------
/**
* @category instances
* @since 1.0.0
* @tsplus static effect/printer/Flatten.Ops Functor
*/
exports.match = match;
const Functor = F.Functor;
exports.Functor = Functor;
// /**
// * @since 1.0.0
// * @category instances
// */
// export const Functor: _Functor<Flatten.TypeLambda> = internal.Functor
exports.map = map;
//# sourceMappingURL=Flatten.js.map
/**
* @since 1.0.0
*/
import { DocStream } from "@effect/printer/DocStream";
import { PageWidth } from "@effect/printer/PageWidth";
import { Doc } from "@effect/printer/Doc";
import type { Option } from "@fp-ts/data/Option";
import type { Predicate } from "@fp-ts/data/Predicate";
import type { Option } from "@effect/data/Option";
import type { Predicate } from "@effect/data/Predicate";
import type { Doc } from "@effect/printer/Doc";
import type { DocStream } from "@effect/printer/DocStream";
import type { PageWidth } from "@effect/printer/PageWidth";
/**
* @since 1.0.0
* @category model
* @since 1.0.0
* @tsplus type effect/printer/Layout
*/

@@ -24,5 +23,4 @@ export interface Layout<A> {

*
* @since 1.0.0
* @category model
* @since 1.0.0
* @tsplus type effect/printer/Layout.Options
*/

@@ -39,4 +37,4 @@ interface Options {

*
* @since 1.0.0
* @category model
* @since 1.0.0
*/

@@ -46,54 +44,22 @@ type FittingPredicate<A> = (lineIndent: number, currentColumn: number, initialIndentY: Option<number>) => Predicate<DocStream<A>>;

/**
* @category model
* @since 1.0.0
* @tsplus type effect/printer/Layout.Ops
*/
export interface LayoutOps {
readonly $: LayoutAspects;
readonly Options: LayoutOptionsOps;
}
/**
* @category model
* @since 1.0.0
* @tsplus type effect/printer/Layout.Options.Ops
*/
export interface LayoutOptionsOps {
(pageWidth: PageWidth): Layout.Options;
}
/**
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/Layout.Ops Options
* @tsplus location "@effect/printer/Layout"
*/
export declare const LayoutOptions: LayoutOptionsOps;
export declare const options: (pageWidth: PageWidth) => Layout.Options;
/**
* @category instances
* @since 1.0.0
*/
export declare const Layout: LayoutOps;
/**
* @category model
* @since 1.0.0
* @tsplus type effect/printer/Layout.Aspects
*/
export interface LayoutAspects {
}
/**
* The default layout options, which are suitable when you want to obtain output
* but do not care about the details.
*
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/Layout.Options.Ops default
* @tsplus location "@effect/printer/Layout"
*/
export declare const defaultLayoutOptions: Layout.Options;
export declare const defaultOptions: Layout.Options;
/**
* @since 1.0.0
* @category layout algorithms
* @since 1.0.0
* @tsplus static effect/printer/Doc.Aspects layoutWadlerLeijen
* @tsplus pipeable effect/printer/Doc layoutWadlerLeijen
* @tsplus location "@effect/printer/Layout"
*/
export declare const wadlerLeijen: <A>(fits: Layout.FittingPredicate<A>, options: Layout.Options) => (self: Doc<A>) => DocStream<A>;
export declare const wadlerLeijen: {
<A>(fits: Layout.FittingPredicate<A>, options: Layout.Options): (self: Doc<A>) => DocStream<A>;
<A>(self: Doc<A>, fits: Layout.FittingPredicate<A>, options: Layout.Options): DocStream<A>;
};
/**

@@ -106,43 +72,43 @@ * A layout algorithm which will lay out a document without adding any

* can be used for output that is read by other programs.
* @example import * as Doc from "@effect/printer/Doc"
import * as Render from "@effect/printer/Render"
import { pipe } from "@fp-ts/data/Function"
import * as String from "@fp-ts/data/String"
const doc = pipe(
Doc.vsep([
Doc.text("lorem"),
Doc.text("ipsum"),
pipe(
Doc.vsep([Doc.text("dolor"), Doc.text("sit")]),
Doc.hang(4)
)
]),
Doc.hang(4)
)
assert.strictEqual(
Render.prettyDefault(doc),
String.stripMargin(
`|lorem
| ipsum
| dolor
| sit`
)
)
assert.strictEqual(
Render.compact(doc),
String.stripMargin(
`|lorem
|ipsum
|dolor
|sit`
)
)
*
* @example
* import * as Doc from "@effect/printer/Doc"
* import * as Render from "@effect/printer/Render"
* import { pipe } from "@effect/data/Function"
* import * as String from "@effect/data/String"
*
* const doc = pipe(
* Doc.vsep([
* Doc.text("lorem"),
* Doc.text("ipsum"),
* pipe(
* Doc.vsep([Doc.text("dolor"), Doc.text("sit")]),
* Doc.hang(4)
* )
* ]),
* Doc.hang(4)
* )
*
* assert.strictEqual(
* Render.prettyDefault(doc),
* String.stripMargin(
* `|lorem
* | ipsum
* | dolor
* | sit`
* )
* )
*
* assert.strictEqual(
* Render.compact(doc),
* String.stripMargin(
* `|lorem
* |ipsum
* |dolor
* |sit`
* )
* )
*
* @since 1.0.0
* @category layout algorithms
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops layoutCompact
* @tsplus getter effect/printer/Doc layoutCompact
* @tsplus location "@effect/printer/Layout"
*/

@@ -161,7 +127,10 @@ export declare const compact: <A>(self: Doc<A>) => DocStream<A>;

* line breaks.
* @tsplus static effect/printer/Doc.Aspects layoutPretty
* @tsplus pipeable effect/printer/Doc layoutPretty
* @tsplus location "@effect/printer/Layout"
*
* @since 1.0.0
* @category layout algorithms
*/
export declare const pretty: (options: Layout.Options) => <A>(self: Doc<A>) => DocStream<A>;
export declare const pretty: {
(options: Layout.Options): <A>(self: Doc<A>) => DocStream<A>;
<A>(self: Doc<A>, options: Layout.Options): DocStream<A>;
};
/**

@@ -171,102 +140,103 @@ * A layout algorithm with more look ahead than `pretty`, which will introduce

* onto one line.
* @example import * as Doc from "@effect/printer/Doc"
import type * as DocStream from "@effect/printer/DocStream"
import * as Layout from "@effect/printer/Layout"
import * as PageWidth from "@effect/printer/PageWidth"
import * as Render from "@effect/printer/Render"
import { flow, pipe } from "@fp-ts/data/Function"
import * as String from "@fp-ts/data/String"
// Consider the following python-ish document:
const fun = <A>(doc: Doc.Doc<A>): Doc.Doc<A> =>
Doc.hcat([
pipe(
Doc.hcat([Doc.text("fun("), Doc.softLineBreak, doc]),
Doc.hang(2)
),
Doc.text(")")
])
const funs = flow(fun, fun, fun, fun, fun)
const doc = funs(Doc.align(Doc.list(Doc.words("abcdef ghijklm"))))
// The document will be rendered using the following pipeline, where the choice
// of layout algorithm has been left open:
const pageWidth = PageWidth.availablePerLine(26, 1)
const layoutOptions = Layout.LayoutOptions(pageWidth)
const dashes = Doc.text(Array.from({ length: 26 - 2 }, () => "-").join(""))
const hr = Doc.hcat([Doc.vbar, dashes, Doc.vbar])
const render = <A>(
doc: Doc.Doc<A>
) =>
(
layoutAlgorithm: (options: Layout.Layout.Options) => (doc: Doc.Doc<A>) => DocStream.DocStream<A>
): string => pipe(Doc.vsep([hr, doc, hr]), layoutAlgorithm(layoutOptions), Render.render)
// If rendered using `Layout.pretty`, with a page width of `26` characters per line,
// all the calls to `fun` will fit into the first line. However, this exceeds the
// desired `26` character page width.
assert.strictEqual(
render(doc)(Layout.pretty),
String.stripMargin(
`||------------------------|
|fun(fun(fun(fun(fun(
| [ abcdef
| , ghijklm ])))))
||------------------------|`
)
)
// The same document, rendered with `Layout.smart`, fits the layout contstraints:
assert.strictEqual(
render(doc)(Layout.smart),
String.stripMargin(
`||------------------------|
|fun(
| fun(
| fun(
| fun(
| fun(
| [ abcdef
| , ghijklm ])))))
||------------------------|`
)
)
// The key difference between `Layout.pretty` and `Layout.smart` is that the
// latter will check the potential document until it encounters a line with the
// same indentation or less than the start of the document. Any line encountered
// earlier is assumed to belong to the same syntactic structure. In contrast,
// `Layout.pretty` checks only the first line.
// Consider for example the question of whether the `A`s fit into the document
// below:
// > 1 A
// > 2 A
// > 3 A
// > 4 B
// > 5 B
// `pretty` will check only the first line, ignoring whether the second line
// may already be too wide. In contrast, `Layout.smart` stops only once it reaches
// the fourth line 4, where the `B` has the same indentation as the first `A`.
*
* @example
* import * as Doc from "@effect/printer/Doc"
* import type * as DocStream from "@effect/printer/DocStream"
* import * as Layout from "@effect/printer/Layout"
* import * as PageWidth from "@effect/printer/PageWidth"
* import * as Render from "@effect/printer/Render"
* import { flow, pipe } from "@effect/data/Function"
* import * as String from "@effect/data/String"
*
* // Consider the following python-ish document:
* const fun = <A>(doc: Doc.Doc<A>): Doc.Doc<A> =>
* Doc.hcat([
* pipe(
* Doc.hcat([Doc.text("fun("), Doc.softLineBreak, doc]),
* Doc.hang(2)
* ),
* Doc.text(")")
* ])
*
* const funs = flow(fun, fun, fun, fun, fun)
*
* const doc = funs(Doc.align(Doc.list(Doc.words("abcdef ghijklm"))))
*
* // The document will be rendered using the following pipeline, where the choice
* // of layout algorithm has been left open:
* const pageWidth = PageWidth.availablePerLine(26, 1)
* const layoutOptions = Layout.LayoutOptions(pageWidth)
* const dashes = Doc.text(Array.from({ length: 26 - 2 }, () => "-").join(""))
* const hr = Doc.hcat([Doc.vbar, dashes, Doc.vbar])
*
* const render = <A>(
* doc: Doc.Doc<A>
* ) =>
* (
* layoutAlgorithm: (options: Layout.Layout.Options) => (doc: Doc.Doc<A>) => DocStream.DocStream<A>
* ): string => pipe(Doc.vsep([hr, doc, hr]), layoutAlgorithm(layoutOptions), Render.render)
*
* // If rendered using `Layout.pretty`, with a page width of `26` characters per line,
* // all the calls to `fun` will fit into the first line. However, this exceeds the
* // desired `26` character page width.
* assert.strictEqual(
* render(doc)(Layout.pretty),
* String.stripMargin(
* `||------------------------|
* |fun(fun(fun(fun(fun(
* | [ abcdef
* | , ghijklm ])))))
* ||------------------------|`
* )
* )
*
* // The same document, rendered with `Layout.smart`, fits the layout contstraints:
* assert.strictEqual(
* render(doc)(Layout.smart),
* String.stripMargin(
* `||------------------------|
* |fun(
* | fun(
* | fun(
* | fun(
* | fun(
* | [ abcdef
* | , ghijklm ])))))
* ||------------------------|`
* )
* )
*
* // The key difference between `Layout.pretty` and `Layout.smart` is that the
* // latter will check the potential document until it encounters a line with the
* // same indentation or less than the start of the document. Any line encountered
* // earlier is assumed to belong to the same syntactic structure. In contrast,
* // `Layout.pretty` checks only the first line.
*
* // Consider for example the question of whether the `A`s fit into the document
* // below:
* // > 1 A
* // > 2 A
* // > 3 A
* // > 4 B
* // > 5 B
*
* // `pretty` will check only the first line, ignoring whether the second line
* // may already be too wide. In contrast, `Layout.smart` stops only once it reaches
* // the fourth line 4, where the `B` has the same indentation as the first `A`.
*
* @since 1.0.0
* @category layout algorithms
* @since 1.0.0
* @tsplus static effect/printer/Doc.Aspects layoutSmart
* @tsplus pipeable effect/printer/Doc layoutSmart
* @tsplus location "@effect/printer/Layout"
*/
export declare const smart: (options: Layout.Options) => <A>(self: Doc<A>) => DocStream<A>;
export declare const smart: {
(options: Layout.Options): <A>(self: Doc<A>) => DocStream<A>;
<A>(self: Doc<A>, options: Layout.Options): DocStream<A>;
};
/**
* The `unbounded` layout algorithm will lay out a document an `Unbounded`
* page width.
*
* @since 1.0.0
* @category layout algorithms
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops layoutUnbounded
* @tsplus getter effect/printer/Doc layoutUnbounded
* @tsplus location "@effect/printer/Layout"
*/
export declare const unbounded: <A>(self: Doc<A>) => DocStream<A>;
//# sourceMappingURL=Layout.d.ts.map

@@ -6,5 +6,5 @@ "use strict";

});
exports.wadlerLeijen = exports.unbounded = exports.smart = exports.pretty = exports.defaultLayoutOptions = exports.compact = exports.LayoutOptions = exports.Layout = void 0;
var tsplus_module_1 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/printer/PageWidth"));
var L = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/printer/internal/Layout"));
exports.wadlerLeijen = exports.unbounded = exports.smart = exports.pretty = exports.options = exports.defaultOptions = exports.compact = void 0;
var internal = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/printer/internal_effect_untraced/layout"));
var _PageWidth = /*#__PURE__*/require("@effect/printer/PageWidth");
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

@@ -17,29 +17,15 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

/**
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/Layout.Ops Options
*/
const LayoutOptions_1 = pageWidth => ({
pageWidth
});
const LayoutOptions = LayoutOptions_1;
const options = internal.options;
/**
* @category instances
* @since 1.0.0
*/
exports.LayoutOptions = LayoutOptions;
const Layout = {
$: {},
Options: LayoutOptions_1
};
/**
* The default layout options, which are suitable when you want to obtain output
* but do not care about the details.
*
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/Layout.Options.Ops default
*/
exports.Layout = Layout;
const defaultLayoutOptions = /*#__PURE__*/LayoutOptions_1(tsplus_module_1.defaultPageWidth);
exports.options = options;
const defaultOptions = /*#__PURE__*/options(_PageWidth.defaultPageWidth);
// -----------------------------------------------------------------------------

@@ -49,9 +35,7 @@ // Layout Algorithms

/**
* @since 1.0.0
* @category layout algorithms
* @since 1.0.0
* @tsplus static effect/printer/Doc.Aspects layoutWadlerLeijen
* @tsplus pipeable effect/printer/Doc layoutWadlerLeijen
*/
exports.defaultLayoutOptions = defaultLayoutOptions;
const wadlerLeijen = L.wadlerLeijen;
exports.defaultOptions = defaultOptions;
const wadlerLeijen = internal.wadlerLeijen;
/**

@@ -68,4 +52,4 @@ * A layout algorithm which will lay out a document without adding any

* import * as Render from "@effect/printer/Render"
* import { pipe } from "@fp-ts/data/Function"
* import * as String from "@fp-ts/data/String"
* import { pipe } from "@effect/data/Function"
* import * as String from "@effect/data/String"
*

@@ -104,9 +88,7 @@ * const doc = pipe(

*
* @since 1.0.0
* @category layout algorithms
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops layoutCompact
* @tsplus getter effect/printer/Doc layoutCompact
*/
exports.wadlerLeijen = wadlerLeijen;
const compact = L.compact;
const compact = internal.compact;
/**

@@ -124,7 +106,7 @@ * The `pretty` layout algorithm is the default algorithm for rendering

*
* @tsplus static effect/printer/Doc.Aspects layoutPretty
* @tsplus pipeable effect/printer/Doc layoutPretty
* @since 1.0.0
* @category layout algorithms
*/
exports.compact = compact;
const pretty = L.pretty;
const pretty = internal.pretty;
/**

@@ -141,4 +123,4 @@ * A layout algorithm with more look ahead than `pretty`, which will introduce

* import * as Render from "@effect/printer/Render"
* import { flow, pipe } from "@fp-ts/data/Function"
* import * as String from "@fp-ts/data/String"
* import { flow, pipe } from "@effect/data/Function"
* import * as String from "@effect/data/String"
*

@@ -221,9 +203,7 @@ * // Consider the following python-ish document:

*
* @since 1.0.0
* @category layout algorithms
* @since 1.0.0
* @tsplus static effect/printer/Doc.Aspects layoutSmart
* @tsplus pipeable effect/printer/Doc layoutSmart
*/
exports.pretty = pretty;
const smart = L.smart;
const smart = internal.smart;
/**

@@ -233,10 +213,8 @@ * The `unbounded` layout algorithm will lay out a document an `Unbounded`

*
* @since 1.0.0
* @category layout algorithms
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops layoutUnbounded
* @tsplus getter effect/printer/Doc layoutUnbounded
*/
exports.smart = smart;
const unbounded = L.unbounded;
const unbounded = internal.unbounded;
exports.unbounded = unbounded;
//# sourceMappingURL=Layout.js.map

@@ -1,13 +0,21 @@

Copyright (c) 2019 Michael Arnaldi.
MIT License
Copyright (c) 2020 Matechs Garage Ltd.
Copyright (c) 2020-present The Contributors
Copyright (c) 2020 Matechs Holdings Ltd.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Copyright (c) 2020 The Contributors.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
/**
* @since 1.0.0
*/
import { Doc } from "@effect/printer/Doc";
import type { Doc } from "@effect/printer/Doc";
/**

@@ -9,5 +9,4 @@ * Represents optimization of a given document tree through fusion of redundant

*
* @since 1.0.0
* @category model
* @since 1.0.0
* @tsplus type effect/printer/Optimize
*/

@@ -18,20 +17,4 @@ export interface Optimize<A> {

/**
* @category model
* @since 1.0.0
* @tsplus type effect/printer/Optimize.Ops
*/
export interface OptimizeOps {
readonly $: OptimizeAspects;
readonly Depth: FusionDepthOps;
}
/**
* @category model
* @since 1.0.0
* @tsplus type effect/printer/Optimize.Aspects
*/
export interface OptimizeAspects {
}
/**
* @since 1.0.0
*/
export declare namespace Optimize {

@@ -44,30 +27,12 @@ type Depth = FusionDepth;

*
* @since 1.0.0
* @category model
* @since 1.0.0
* @tsplus type effect/printer/Optimize.Depth
*/
export type FusionDepth = Shallow | Deep;
/**
* @category model
* @since 1.0.0
* @tsplus type effect/printer/Optimize.Depth.Ops
*/
export interface FusionDepthOps {
}
/**
* @category instances
* @since 1.0.0
*/
export declare const FusionDepth: FusionDepthOps;
/**
* @category instances
* @since 1.0.0
*/
export declare const Optimize: OptimizeOps;
/**
* Instructs the document fusion optimizer to avoid diving deeply into nested
* documents, fusing mostly concatenations of text nodes together.
*
* @since 1.0.0
* @category model
* @since 1.0.0
*/

@@ -89,4 +54,4 @@ export interface Shallow {

*
* @since 1.0.0
* @category model
* @since 1.0.0
*/

@@ -97,13 +62,9 @@ export interface Deep {

/**
* @since 1.0.0
* @category instances
* @since 1.0.0
* @tsplus static effect/printer/Optimize.Depth.Ops Shallow
* @tsplus location "@effect/printer/Optimize"
*/
export declare const Shallow: FusionDepth;
/**
* @since 1.0.0
* @category instances
* @since 1.0.0
* @tsplus static effect/printer/Optimize.Depth.Ops Deep
* @tsplus location "@effect/printer/Optimize"
*/

@@ -122,27 +83,30 @@ export declare const Deep: FusionDepth;

* strings that are used many times.
* @example import * as Doc from "@effect/printer/Doc"
import * as Optimize from "@effect/printer/Optimize"
// The document below contains a chain of four entries in the output `DocStream`
const inefficient = Doc.hsep([
Doc.char("a"),
Doc.char("b"),
Doc.char("c"),
Doc.char("d")
])
// However, the above document is fully equivalent to the tightly packed
// document below which is only a single entry in the output `DocStream` and
// can be processed much more efficiently.
const efficient = Doc.text("abcd")
// We can optimize the `inefficient` document using `Optimize`
Optimize.optimize(Optimize.Deep)(inefficient)
*
* @example
* import * as Doc from "@effect/printer/Doc"
* import * as Optimize from "@effect/printer/Optimize"
*
* // The document below contains a chain of four entries in the output `DocStream`
* const inefficient = Doc.hsep([
* Doc.char("a"),
* Doc.char("b"),
* Doc.char("c"),
* Doc.char("d")
* ])
*
* // However, the above document is fully equivalent to the tightly packed
* // document below which is only a single entry in the output `DocStream` and
* // can be processed much more efficiently.
* const efficient = Doc.text("abcd")
*
* // We can optimize the `inefficient` document using `Optimize`
* Optimize.optimize(Optimize.Deep)(inefficient)
*
* @since 1.0.0
* @category optimization
* @since 1.0.0
* @tsplus static effect/printer/Doc.Aspects optimize
* @tsplus pipeable effect/printer/Doc optimize
* @tsplus location "@effect/printer/Optimize"
*/
export declare const optimize: <A>(depth: FusionDepth) => (self: Doc<A>) => Doc<A>;
export declare const optimize: {
(depth: FusionDepth): <A>(self: Doc<A>) => Doc<A>;
<A>(self: Doc<A>, depth: FusionDepth): Doc<A>;
};
//# sourceMappingURL=Optimize.d.ts.map

@@ -6,4 +6,4 @@ "use strict";

});
exports.optimize = exports.Shallow = exports.Optimize = exports.FusionDepth = exports.Deep = void 0;
var O = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/printer/internal/Optimize"));
exports.optimize = exports.Shallow = exports.Deep = void 0;
var internal = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/printer/internal_effect_untraced/optimize"));
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

@@ -16,21 +16,5 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

/**
* @category instances
* @since 1.0.0
*/
const FusionDepth = {};
/**
* @category instances
* @since 1.0.0
*/
exports.FusionDepth = FusionDepth;
const Optimize = {
$: {},
Depth: FusionDepth
};
/**
* @category instances
* @since 1.0.0
* @tsplus static effect/printer/Optimize.Depth.Ops Shallow
*/
exports.Optimize = Optimize;
const Shallow = {

@@ -40,5 +24,4 @@ _tag: "Shallow"

/**
* @since 1.0.0
* @category instances
* @since 1.0.0
* @tsplus static effect/printer/Optimize.Depth.Ops Deep
*/

@@ -84,10 +67,8 @@ exports.Shallow = Shallow;

*
* @since 1.0.0
* @category optimization
* @since 1.0.0
* @tsplus static effect/printer/Doc.Aspects optimize
* @tsplus pipeable effect/printer/Doc optimize
*/
exports.Deep = Deep;
const optimize = O.optimize;
const optimize = internal.optimize;
exports.optimize = optimize;
//# sourceMappingURL=Optimize.js.map
{
"name": "@effect/printer",
"version": "0.1.11",
"version": "0.2.0",
"license": "MIT",
"repository": "https://github.com/Effect-TS/printer.git",
"repository": {
"type": "git",
"url": "https://github.com/Effect-TS/printer.git"
},
"dependencies": {
"@fp-ts/core": "~0.0.9",
"@fp-ts/data": "~0.0.22"
"@effect/data": "^0.3.2",
"@effect/io": "^0.6.0"
},

@@ -10,0 +13,0 @@ "main": "./index.js",

/**
* @since 1.0.0
*/
import type * as Equal from "@fp-ts/data/Equal";
declare const TypeId: unique symbol;
import type { Equal } from "@effect/data/Equal";
/**
* @since 1.0.0
* @category symbol
*/
export declare const PageWidthTypeId: unique symbol;
/**
* @since 1.0.0
* @category symbol
*/
export type TypeId = typeof TypeId;
export type PageWidthTypeId = typeof PageWidthTypeId;
/**

@@ -16,17 +20,27 @@ * Represents the maximum number of characters that fit onto a single line in a

*
* @since 1.0.0
* @category model
* @since 1.0.0
* @tsplus type effect/printer/PageWidth
*/
export type PageWidth = AvailablePerLine | Unbounded;
/**
* @since 1.0.0
*/
export declare namespace PageWidth {
/**
* @since 1.0.0
* @category model
*/
interface Proto extends Equal {
readonly [PageWidthTypeId]: PageWidthTypeId;
}
}
/**
* Represents a `PageWidth` setting that informs the layout algorithms to avoid
* exceeding the specified space per line.
*
* @since 1.0.0
* @category model
* @since 1.0.0
*/
export interface AvailablePerLine extends Equal.Equal {
export interface AvailablePerLine extends PageWidth.Proto {
readonly _tag: "AvailablePerLine";
readonly _id: TypeId;
/**

@@ -48,30 +62,13 @@ * The number of characters, including whitespace, that can fit on a single

*
* @since 1.0.0
* @category model
* @since 1.0.0
*/
export interface Unbounded extends Equal.Equal {
export interface Unbounded extends PageWidth.Proto {
readonly _tag: "Unbounded";
readonly _id: TypeId;
}
/**
* @category model
* Returns `true` if the specified value is a `PageWidth`, `false` otherwise.
*
* @since 1.0.0
* @tsplus type effect/printer/PageWidth.Ops
*/
export interface PageWidthOps {
}
export declare const PageWidth: PageWidthOps;
/**
* @category model
* @since 1.0.0
* @tsplus type effect/printer/PageWidth/Aspects
*/
export interface PageWidthAspects {
}
/**
* Returns `true` if the specified value is a `PageWidth`, `false` otherwise.
* @category refinements
* @since 1.0.0
* @tsplus static effect/printer/PageWidth.Ops isPageWidth
* @tsplus location "@effect/printer/PageWidth"
*/

@@ -82,6 +79,5 @@ export declare const isPageWidth: (u: unknown) => u is PageWidth;

* otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus fluent effect/printer/PageWidth isAvailablePerLine
* @tsplus location "@effect/printer/PageWidth"
*/

@@ -92,27 +88,20 @@ export declare const isAvailablePerLine: (self: PageWidth) => self is AvailablePerLine;

* otherwise.
*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus fluent effect/printer/PageWidth isUnbounded
* @tsplus location "@effect/printer/PageWidth"
*/
export declare const isUnbounded: (self: PageWidth) => self is Unbounded;
/**
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/PageWidth.Ops AvailablePerLine
* @tsplus location "@effect/printer/PageWidth"
*/
export declare const availablePerLine: (lineWidth: number, ribbonFraction: number) => PageWidth;
/**
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/PageWidth.Ops Unbounded
* @tsplus location "@effect/printer/PageWidth"
*/
export declare const unbounded: PageWidth;
/**
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/PageWidth.Ops default
* @tsplus location "@effect/printer/PageWidth"
*/

@@ -122,9 +111,7 @@ export declare const defaultPageWidth: PageWidth;

* Calculates the remaining width on the current line.
*
* @since 1.0.0
* @category utilities
* @since 1.0.0
* @tsplus static effect/printer/PageWidth.Ops remainingWidth
* @tsplus location "@effect/printer/PageWidth"
*/
export declare const remainingWidth: (lineLength: number, ribbonFraction: number, lineIndent: number, currentColumn: number) => number;
export {};
//# sourceMappingURL=PageWidth.d.ts.map

@@ -6,4 +6,4 @@ "use strict";

});
exports.unbounded = exports.remainingWidth = exports.isUnbounded = exports.isPageWidth = exports.isAvailablePerLine = exports.defaultPageWidth = exports.availablePerLine = exports.PageWidth = void 0;
var PW = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/printer/internal/PageWidth"));
exports.unbounded = exports.remainingWidth = exports.isUnbounded = exports.isPageWidth = exports.isAvailablePerLine = exports.defaultPageWidth = exports.availablePerLine = exports.PageWidthTypeId = void 0;
var internal = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/printer/internal_effect_untraced/pageWidth"));
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

@@ -18,4 +18,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// -----------------------------------------------------------------------------
const TypeId = PW.PageWidthTypeId;
const PageWidth = {};
/**
* @since 1.0.0
* @category symbol
*/
const PageWidthTypeId = internal.PageWidthTypeId;
// -----------------------------------------------------------------------------

@@ -27,8 +30,7 @@ // Refinements

*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus static effect/printer/PageWidth.Ops isPageWidth
*/
exports.PageWidth = PageWidth;
const isPageWidth = PW.isPageWidth;
exports.PageWidthTypeId = PageWidthTypeId;
const isPageWidth = internal.isPageWidth;
/**

@@ -38,8 +40,7 @@ * Returns `true` if the specified `PageWidth` is an `AvailablePerLine`, `false`

*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus fluent effect/printer/PageWidth isAvailablePerLine
*/
exports.isPageWidth = isPageWidth;
const isAvailablePerLine = PW.isAvailablePerLine;
const isAvailablePerLine = internal.isAvailablePerLine;
/**

@@ -49,8 +50,7 @@ * Returns `true` if the specified `PageWidth` is an `Unbounded`, `false`

*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus fluent effect/printer/PageWidth isUnbounded
*/
exports.isAvailablePerLine = isAvailablePerLine;
const isUnbounded = PW.isUnbounded;
const isUnbounded = internal.isUnbounded;
// -----------------------------------------------------------------------------

@@ -60,22 +60,19 @@ // Constructors

/**
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/PageWidth.Ops AvailablePerLine
*/
exports.isUnbounded = isUnbounded;
const availablePerLine = PW.availablePerLine;
const availablePerLine = internal.availablePerLine;
/**
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/PageWidth.Ops Unbounded
*/
exports.availablePerLine = availablePerLine;
const unbounded = PW.unbounded;
const unbounded = internal.unbounded;
/**
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/PageWidth.Ops default
*/
exports.unbounded = unbounded;
const defaultPageWidth = /*#__PURE__*/PW.availablePerLine(80, 1);
const defaultPageWidth = internal.defaultPageWidth;
// -----------------------------------------------------------------------------

@@ -87,9 +84,8 @@ // Utilities

*
* @since 1.0.0
* @category utilities
* @since 1.0.0
* @tsplus static effect/printer/PageWidth.Ops remainingWidth
*/
exports.defaultPageWidth = defaultPageWidth;
const remainingWidth = PW.remainingWidth;
const remainingWidth = internal.remainingWidth;
exports.remainingWidth = remainingWidth;
//# sourceMappingURL=PageWidth.js.map

@@ -1,2 +0,2 @@

[![Main CI](https://github.com/Effect-TS/printer/actions/workflows/main.yml/badge.svg)](https://github.com/Effect-TS/printer/actions/workflows/main.yml)
[![CI](https://github.com/Effect-TS/printer/actions/workflows/main.yml/badge.svg)](https://github.com/Effect-TS/printer/actions/workflows/main.yml)
[![Gitpod Ready-to-Code](https://img.shields.io/badge/Gitpod-ready--to--code-908a85?logo=gitpod)](https://gitpod.io/#https://github.com/Effect-TS/printer)

@@ -40,3 +40,3 @@

The documenists of several parts:
The document consists of several parts:
1. Just below is some general information about the library

@@ -58,4 +58,4 @@ 2. The actual library with extensive documentation and examples

import * as Render from "@effect/printer/Render"
import { pipe } from "@fp-ts/data/Function"
import * as ReadonlyArray from "@fp-ts/data/ReadonlyArray"
import { pipe } from "@effect/data/Function"
import * as ReadonlyArray from "@effect/data/ReadonlyArray"
```

@@ -68,4 +68,3 @@

const symbolDocuments = pipe(
types.length - 1,
ReadonlyArray.makeBy(() => Doc.text("->")),
ReadonlyArray.makeBy(types.length - 1, () => Doc.text("->")),
ReadonlyArray.prepend(Doc.text("::"))

@@ -75,8 +74,10 @@ )

const documents = pipe(
symbolDocuments,
ReadonlyArray.zipWith(typeDocuments, (left, right) =>
pipe(left, Doc.catWithSpace(right))
ReadonlyArray.zipWith(
symbolDocuments,
typeDocuments,
(left, right) => Doc.catWithSpace(left, right)
)
)
return pipe(documents, Doc.seps, Doc.align)
return Doc.align(Doc.seps(documents))
}

@@ -93,8 +94,3 @@ ```

types: ReadonlyArray<string>
): Doc.Doc<never> => {
return pipe(
Doc.text(name),
Doc.catWithSpace(prettyTypes(types))
)
}
): Doc.Doc<never> => Doc.catWithSpace(Doc.text(name), prettyTypes(types))
```

@@ -115,3 +111,3 @@

```ts
const rendered = pipe(doc, Render.prettyDefault)
const rendered = Render.prettyDefault(doc)
console.log(rendered)

@@ -124,3 +120,3 @@ // example :: Int -> Bool -> Char -> IO ()

```ts
const rendered = pipe(doc, Render.pretty(20))
const rendered = Render.pretty(doc, { lineWidth: 20 })
console.log(rendered)

@@ -127,0 +123,0 @@ // example :: Int

/**
* @since 1.0.0
*/
import { DocStream } from "@effect/printer/DocStream";
import { Doc } from "@effect/printer/Doc";
import type { Doc } from "@effect/printer/Doc";
import type { DocStream } from "@effect/printer/DocStream";
import type { AvailablePerLine } from "@effect/printer/PageWidth";
/**

@@ -11,49 +12,48 @@ * Renders a `DocStream` to a `string`.

* into a `DocStream` prior to rendering.
* @tsplus static effect/printer/DocStream.Ops render
* @tsplus getter effect/printer/DocStream render
* @tsplus location "@effect/printer/Render"
*
* @since 1.0.0
* @category rendering
*/
export declare const render: <A>(self: DocStream<A>) => string;
/**
* @tsplus static effect/printer/Doc.Ops compact
* @tsplus getter effect/printer/Doc compact
* @tsplus location "@effect/printer/Render"
* @since 1.0.0
* @category rendering
*/
export declare const compact: <A>(self: Doc<A>) => string;
/**
* @tsplus static effect/printer/Doc.Aspects pretty
* @tsplus pipeable effect/printer/Doc pretty
* @tsplus location "@effect/printer/Render"
* @since 1.0.0
* @category rendering
*/
export declare const pretty: (lineWidth: number, ribbonFraction?: number) => <A>(self: Doc<A>) => string;
export declare const pretty: {
(options: Partial<Omit<AvailablePerLine, "_tag">>): <A>(self: Doc<A>) => string;
<A>(self: Doc<A>, options: Partial<Omit<AvailablePerLine, "_tag">>): string;
};
/**
* @tsplus static effect/printer/Doc.Ops prettyDefault
* @tsplus getter effect/printer/Doc prettyDefault
* @tsplus location "@effect/printer/Render"
* @since 1.0.0
* @category rendering
*/
export declare const prettyDefault: <A>(self: Doc<A>) => string;
/**
* @tsplus static effect/printer/Doc.Ops prettyUnbounded
* @tsplus getter effect/printer/Doc prettyUnbounded
* @tsplus location "@effect/printer/Render"
* @since 1.0.0
* @category rendering
*/
export declare const prettyUnbounded: <A>(self: Doc<A>) => string;
/**
* @tsplus static effect/printer/Doc.Aspects smart
* @tsplus pipeable effect/printer/Doc smart
* @tsplus location "@effect/printer/Render"
* @since 1.0.0
* @category rendering
*/
export declare const smart: <A>(lineWidth: number, ribbonFraction?: number) => (self: Doc<A>) => string;
export declare const smart: {
(options: Partial<Omit<AvailablePerLine, "_tag">>): <A>(self: Doc<A>) => string;
<A>(self: Doc<A>, options: Partial<Omit<AvailablePerLine, "_tag">>): string;
};
/**
* @tsplus static effect/printer/Doc.Ops smartDefault
* @tsplus getter effect/printer/Doc smartDefault
* @tsplus location "@effect/printer/Render"
* @since 1.0.0
* @category rendering
*/
export declare const smartDefault: <A>(self: Doc<A>) => string;
/**
* @tsplus static effect/printer/Doc.Ops smartUnbounded
* @tsplus getter effect/printer/Doc smartUnbounded
* @tsplus location "@effect/printer/Render"
* @since 1.0.0
* @category rendering
*/
export declare const smartUnbounded: <A>(self: Doc<A>) => string;
//# sourceMappingURL=Render.d.ts.map

@@ -7,3 +7,3 @@ "use strict";

exports.smartUnbounded = exports.smartDefault = exports.smart = exports.render = exports.prettyUnbounded = exports.prettyDefault = exports.pretty = exports.compact = void 0;
var R = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/printer/internal/Render"));
var internal = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/printer/internal_effect_untraced/render"));
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

@@ -24,49 +24,49 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

*
* @tsplus static effect/printer/DocStream.Ops render
* @tsplus getter effect/printer/DocStream render
* @since 1.0.0
* @category rendering
*/
const render = R.render;
const render = internal.render;
/**
* @tsplus static effect/printer/Doc.Ops compact
* @tsplus getter effect/printer/Doc compact
* @since 1.0.0
* @category rendering
*/
exports.render = render;
const compact = R.compact;
const compact = internal.compact;
/**
* @tsplus static effect/printer/Doc.Aspects pretty
* @tsplus pipeable effect/printer/Doc pretty
* @since 1.0.0
* @category rendering
*/
exports.compact = compact;
const pretty = R.pretty;
const pretty = internal.pretty;
/**
* @tsplus static effect/printer/Doc.Ops prettyDefault
* @tsplus getter effect/printer/Doc prettyDefault
* @since 1.0.0
* @category rendering
*/
exports.pretty = pretty;
const prettyDefault = R.prettyDefault;
const prettyDefault = internal.prettyDefault;
/**
* @tsplus static effect/printer/Doc.Ops prettyUnbounded
* @tsplus getter effect/printer/Doc prettyUnbounded
* @since 1.0.0
* @category rendering
*/
exports.prettyDefault = prettyDefault;
const prettyUnbounded = R.prettyUnbounded;
const prettyUnbounded = internal.prettyUnbounded;
/**
* @tsplus static effect/printer/Doc.Aspects smart
* @tsplus pipeable effect/printer/Doc smart
* @since 1.0.0
* @category rendering
*/
exports.prettyUnbounded = prettyUnbounded;
const smart = R.smart;
const smart = internal.smart;
/**
* @tsplus static effect/printer/Doc.Ops smartDefault
* @tsplus getter effect/printer/Doc smartDefault
* @since 1.0.0
* @category rendering
*/
exports.smart = smart;
const smartDefault = R.smartDefault;
const smartDefault = internal.smartDefault;
/**
* @tsplus static effect/printer/Doc.Ops smartUnbounded
* @tsplus getter effect/printer/Doc smartUnbounded
* @since 1.0.0
* @category rendering
*/
exports.smartDefault = smartDefault;
const smartUnbounded = R.smartUnbounded;
const smartUnbounded = internal.smartUnbounded;
exports.smartUnbounded = smartUnbounded;
//# sourceMappingURL=Render.js.map

@@ -5,7 +5,9 @@ /**

import * as DS from "@effect/printer/internal/DocStream"
import type { TypeLambda } from "@fp-ts/core/HKT"
import type { Covariant as _Functor } from "@fp-ts/core/typeclass/Covariant"
import type { Monoid } from "@fp-ts/core/typeclass/Monoid"
import type { Option } from "@fp-ts/data/Option"
import type { Equal } from "@effect/data/Equal"
import type { TypeLambda } from "@effect/data/HKT"
import type { Option } from "@effect/data/Option"
import type * as covariant from "@effect/data/typeclass/Covariant"
import type * as invariant from "@effect/data/typeclass/Invariant"
import type * as monoid from "@effect/data/typeclass/Monoid"
import * as internal from "@effect/printer/internal_effect_untraced/docStream"

@@ -16,9 +18,13 @@ // -----------------------------------------------------------------------------

const TypeId: unique symbol = DS.DocStreamTypeId as TypeId
/**
* @since 1.0.0
* @category symbol
*/
export const DocStreamTypeId: unique symbol = internal.DocStreamTypeId as DocStreamTypeId
/**
* @since 1.0.0
* @category symbol
* @since 1.0.0
*/
export type TypeId = typeof TypeId
export type DocStreamTypeId = typeof DocStreamTypeId

@@ -35,5 +41,4 @@ /**

*
* @since 1.0.0
* @category model
* @since 1.0.0
* @tsplus type effect/printer/DocStream
*/

@@ -53,2 +58,16 @@ export type DocStream<A> =

export declare namespace DocStream {
/**
* @since 1.0.0
* @category model
*/
export interface Variance<A> extends Equal {
readonly [DocStreamTypeId]: {
readonly _A: (_: never) => A
}
}
/**
* @since 1.0.0
* @category model
*/
export type TypeLambda = DocStreamTypeLambda

@@ -58,20 +77,4 @@ }

/**
* @category model
* @since 1.0.0
* @tsplus type effect/printer/DocStream.Ops
*/
export interface DocStreamOps {
$: DocStreamAspects
}
/**
* @category instances
* @since 1.0.0
*/
export const DocStream: DocStreamOps = {
$: {}
}
/**
* @category model
* @since 1.0.0
*/

@@ -83,19 +86,9 @@ export interface DocStreamTypeLambda extends TypeLambda {

/**
* @category model
* @since 1.0.0
*
* @tsplus type effect/printer/DocStream.Aspects
*/
export interface DocStreamAspects {}
/**
* Represents a `Doc` that failed to be laid out.
*
* @since 1.0.0
* @category model
* @since 1.0.0
*/
export interface FailedStream<A> {
export interface FailedStream<A> extends DocStream.Variance<A> {
readonly _tag: "FailedStream"
readonly _id: TypeId
readonly _A: (_: never) => A
}

@@ -106,9 +99,7 @@

*
* @since 1.0.0
* @category model
* @since 1.0.0
*/
export interface EmptyStream<A> {
export interface EmptyStream<A> extends DocStream.Variance<A> {
readonly _tag: "EmptyStream"
readonly _id: TypeId
readonly _A: (_: never) => A
}

@@ -119,9 +110,7 @@

*
* @since 1.0.0
* @category model
* @since 1.0.0
*/
export interface CharStream<A> {
export interface CharStream<A> extends DocStream.Variance<A> {
readonly _tag: "CharStream"
readonly _id: TypeId
readonly _A: (_: never) => A
readonly char: string

@@ -134,9 +123,7 @@ readonly stream: DocStream<A>

*
* @since 1.0.0
* @category model
* @since 1.0.0
*/
export interface TextStream<A> {
export interface TextStream<A> extends DocStream.Variance<A> {
readonly _tag: "TextStream"
readonly _id: TypeId
readonly _A: (_: never) => A
readonly text: string

@@ -151,9 +138,7 @@ readonly stream: DocStream<A>

*
* @since 1.0.0
* @category model
* @since 1.0.0
*/
export interface LineStream<A> {
export interface LineStream<A> extends DocStream.Variance<A> {
readonly _tag: "LineStream"
readonly _id: TypeId
readonly _A: (_: never) => A
readonly indentation: number

@@ -166,9 +151,7 @@ readonly stream: DocStream<A>

*
* @since 1.0.0
* @category model
* @since 1.0.0
*/
export interface PushAnnotationStream<A> {
export interface PushAnnotationStream<A> extends DocStream.Variance<A> {
readonly _tag: "PushAnnotationStream"
readonly _id: TypeId
readonly _A: (_: never) => A
readonly annotation: A

@@ -181,9 +164,7 @@ readonly stream: DocStream<A>

*
* @since 1.0.0
* @category model
* @since 1.0.0
*/
export interface PopAnnotationStream<A> {
export interface PopAnnotationStream<A> extends DocStream.Variance<A> {
readonly _tag: "PopAnnotationStream"
readonly _id: TypeId
readonly _A: (_: never) => A
readonly stream: DocStream<A>

@@ -199,7 +180,6 @@ }

*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus static effect/printer/DocStream.Ops isDocStream
*/
export const isDocStream: (u: unknown) => u is DocStream<unknown> = DS.isDocStream
export const isDocStream: (u: unknown) => u is DocStream<unknown> = internal.isDocStream

@@ -209,7 +189,6 @@ /**

*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus fluent effect/printer/DocStream isFailedStream
*/
export const isFailedStream: <A>(self: DocStream<A>) => self is FailedStream<A> = DS.isFailedStream
export const isFailedStream: <A>(self: DocStream<A>) => self is FailedStream<A> = internal.isFailedStream

@@ -219,7 +198,6 @@ /**

*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus fluent effect/printer/DocStream isEmptyStream
*/
export const isEmptyStream: <A>(self: DocStream<A>) => self is EmptyStream<A> = DS.isEmptyStream
export const isEmptyStream: <A>(self: DocStream<A>) => self is EmptyStream<A> = internal.isEmptyStream

@@ -229,7 +207,6 @@ /**

*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus fluent effect/printer/DocStream isCharStream
*/
export const isCharStream: <A>(self: DocStream<A>) => self is CharStream<A> = DS.isCharStream
export const isCharStream: <A>(self: DocStream<A>) => self is CharStream<A> = internal.isCharStream

@@ -239,7 +216,6 @@ /**

*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus fluent effect/printer/DocStream isTextStream
*/
export const isTextStream: <A>(self: DocStream<A>) => self is TextStream<A> = DS.isTextStream
export const isTextStream: <A>(self: DocStream<A>) => self is TextStream<A> = internal.isTextStream

@@ -249,7 +225,6 @@ /**

*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus fluent effect/printer/DocStream isLineStream
*/
export const isLineStream: <A>(self: DocStream<A>) => self is LineStream<A> = DS.isLineStream
export const isLineStream: <A>(self: DocStream<A>) => self is LineStream<A> = internal.isLineStream

@@ -259,9 +234,8 @@ /**

*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus fluent effect/printer/DocStream isPushAnnotationStream
*/
export const isPushAnnotationStream: <A>(
self: DocStream<A>
) => self is PushAnnotationStream<A> = DS.isPushAnnotationStream
) => self is PushAnnotationStream<A> = internal.isPushAnnotationStream

@@ -271,9 +245,8 @@ /**

*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus fluent effect/printer/DocStream isPopAnnotationStream
*/
export const isPopAnnotationStream: <A>(
self: DocStream<A>
) => self is PopAnnotationStream<A> = DS.isPopAnnotationStream
) => self is PopAnnotationStream<A> = internal.isPopAnnotationStream

@@ -285,61 +258,54 @@ // -----------------------------------------------------------------------------

/**
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/DocStream.Ops failed
*/
export const failed: DocStream<never> = DS.failed
export const failed: DocStream<never> = internal.failed
/**
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/DocStream.Ops empty
*/
export const empty: DocStream<never> = DS.empty
export const empty: DocStream<never> = internal.empty
/**
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/DocStream.Ops char
* @tsplus static effect/printer/DocStream.Aspects char
* @tsplus pipeable effect/printer/DocStream char
*/
export const char: (char: string) => <A>(self: DocStream<A>) => DocStream<A> = DS.char
export const char: {
(char: string): <A>(self: DocStream<A>) => DocStream<A>
<A>(self: DocStream<A>, char: string): DocStream<A>
} = internal.char
/**
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/DocStream.Ops text
* @tsplus static effect/printer/DocStream.Aspects text
* @tsplus pipeable effect/printer/DocStream text
*/
export const text: (text: string) => <A>(stream: DocStream<A>) => DocStream<A> = DS.text
export const text: {
(text: string): <A>(self: DocStream<A>) => DocStream<A>
<A>(self: DocStream<A>, text: string): DocStream<A>
} = internal.text
/**
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/DocStream.Ops line
* @tsplus static effect/printer/DocStream.Aspects line
* @tsplus pipeable effect/printer/DocStream line
*/
export const line: (indentation: number) => <A>(stream: DocStream<A>) => DocStream<A> = DS.line
export const line: {
(indentation: number): <A>(self: DocStream<A>) => DocStream<A>
<A>(self: DocStream<A>, indentation: number): DocStream<A>
} = internal.line
/**
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/DocStream.Ops pushAnnotation
* @tsplus static effect/printer/DocStream.Aspects pushAnnotation
* @tsplus pipeable effect/printer/DocStream pushAnnotation
*/
export const pushAnnotation: <B>(
annotation: B
) => <A>(
stream: DocStream<B>
) => DocStream<A | B> = DS.pushAnnotation
export const pushAnnotation: {
<B>(annotation: B): <A>(self: DocStream<A>) => DocStream<B | A>
<A, B>(self: DocStream<A>, annotation: B): DocStream<A | B>
} = internal.pushAnnotation
/**
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/DocStream.Ops popAnnotation
*/
export const popAnnotation: <A>(stream: DocStream<A>) => DocStream<A> = DS.popAnnotation
export const popAnnotation: <A>(stream: DocStream<A>) => DocStream<A> = internal.popAnnotation

@@ -354,12 +320,9 @@ // -----------------------------------------------------------------------------

*
* @since 1.0.0
* @category annotations
* @since 1.0.0
* @tsplus static effect/printer/DocStream.Aspects alterAnnotations
* @tsplus pipeable effect/printer/DocStream alterAnnotations
*/
export const alterAnnotations: <A, B>(
f: (a: A) => Option<B>
) => (
self: DocStream<A>
) => DocStream<B> = DS.alterAnnotations
export const alterAnnotations: {
<A, B>(f: (a: A) => Option<B>): (self: DocStream<A>) => DocStream<B>
<A, B>(self: DocStream<A>, f: (a: A) => Option<B>): DocStream<B>
} = internal.alterAnnotations

@@ -369,14 +332,9 @@ /**

*
* @since 1.0.0
* @category annotations
* @since 1.0.0
* @tsplus static effect/printer/DocStream.Aspects map
* @tsplus pipeable effect/printer/DocStream map
* @tsplus static effect/printer/DocStream.Aspects reAnnotate
* @tsplus pipeable effect/printer/DocStream reAnnotate
*/
export const reAnnotate: <A, B>(
f: (a: A) => B
) => (
self: DocStream<A>
) => DocStream<B> = DS.reAnnotate
export const reAnnotate: {
<A, B>(f: (a: A) => B): (self: DocStream<A>) => DocStream<B>
<A, B>(self: DocStream<A>, f: (a: A) => B): DocStream<B>
} = internal.reAnnotate

@@ -386,8 +344,6 @@ /**

*
* @since 1.0.0
* @category annotations
* @since 1.0.0
* @tsplus static effect/printer/DocStream.Ops unAnnotate
* @tsplus getter effect/printer/DocStream unAnnotate
*/
export const unAnnotate: <A>(self: DocStream<A>) => DocStream<never> = DS.unAnnotate
export const unAnnotate: <A>(self: DocStream<A>) => DocStream<never> = internal.unAnnotate

@@ -399,30 +355,59 @@ // -----------------------------------------------------------------------------

/**
* @since 1.0.0
* @category folding
*/
export const foldMap: {
<A, M>(M: monoid.Monoid<M>, f: (a: A) => M): (self: DocStream<A>) => M
<A, M>(self: DocStream<A>, M: monoid.Monoid<M>, f: (a: A) => M): M
} = internal.foldMap
/**
* @since 1.0.0
* @tsplus static effect/printer/DocStream.Aspects foldMap
* @tsplus pipeable effect/printer/DocStream foldMap
* @category folding
*/
export const foldMap: <A, M>(M: Monoid<M>, f: (a: A) => M) => (self: DocStream<A>) => M = DS.foldMap
export const match: {
<A, R>(
patterns: {
readonly FailedStream: () => R
readonly EmptyStream: () => R
readonly CharStream: (char: string, stream: DocStream<A>) => R
readonly TextStream: (text: string, stream: DocStream<A>) => R
readonly LineStream: (indentation: number, stream: DocStream<A>) => R
readonly PushAnnotationStream: (annotation: A, stream: DocStream<A>) => R
readonly PopAnnotationStream: (stream: DocStream<A>) => R
}
): (self: DocStream<A>) => R
<A, R>(
self: DocStream<A>,
patterns: {
readonly FailedStream: () => R
readonly EmptyStream: () => R
readonly CharStream: (char: string, stream: DocStream<A>) => R
readonly TextStream: (text: string, stream: DocStream<A>) => R
readonly LineStream: (indentation: number, stream: DocStream<A>) => R
readonly PushAnnotationStream: (annotation: A, stream: DocStream<A>) => R
readonly PopAnnotationStream: (stream: DocStream<A>) => R
}
): R
} = internal.match
/**
* @category folding
* @since 1.0.0
* @tsplus static effect/printer/DocStream.Aspects match
* @tsplus pipeable effect/printer/DocStream match
* @category mapping
*/
export const match: <A, R>(patterns: {
readonly FailedStream: () => R
readonly EmptyStream: () => R
readonly CharStream: (char: string, stream: DocStream<A>) => R
readonly TextStream: (text: string, stream: DocStream<A>) => R
readonly LineStream: (indentation: number, stream: DocStream<A>) => R
readonly PushAnnotationStream: (annotation: A, stream: DocStream<A>) => R
readonly PopAnnotationStream: (stream: DocStream<A>) => R
}) => (self: DocStream<A>) => R = DS.match
export const map: {
<A, B>(f: (a: A) => B): (self: DocStream<A>) => DocStream<B>
<A, B>(self: DocStream<A>, f: (a: A) => B): DocStream<B>
} = internal.map
/**
* @since 1.0.0
* @category instances
*/
export const Functor: covariant.Covariant<DocStreamTypeLambda> = internal.Covariant
/**
* @since 1.0.0
* @tsplus static effect/printer/DocStream.Ops Functor
* @category instances
*/
export const Functor: _Functor<DocStream.TypeLambda> = DS.Functor
export const Invariant: invariant.Invariant<DocStreamTypeLambda> = internal.Invariant

@@ -5,8 +5,11 @@ /**

import * as DT from "@effect/printer/internal/DocTree"
import type { TypeLambda } from "@fp-ts/core/HKT"
import type { Covariant as _Functor } from "@fp-ts/core/typeclass/Covariant"
import type { Monoid } from "@fp-ts/core/typeclass/Monoid"
import type { Semigroup } from "@fp-ts/core/typeclass/Semigroup"
import type { Chunk } from "@fp-ts/data/Chunk"
import type { Chunk } from "@effect/data/Chunk"
import type { Equal } from "@effect/data/Equal"
import type { TypeLambda } from "@effect/data/HKT"
import type * as covariant from "@effect/data/typeclass/Covariant"
import type * as invariant from "@effect/data/typeclass/Invariant"
import type * as monoid from "@effect/data/typeclass/Monoid"
import type * as semigroup from "@effect/data/typeclass/Semigroup"
import type * as DocStream from "@effect/printer/DocStream"
import * as internal from "@effect/printer/internal_effect_untraced/docTree"

@@ -17,9 +20,13 @@ // -----------------------------------------------------------------------------

const TypeId: unique symbol = DT.DocTreeTypeId as TypeId
/**
* @since 1.0.0
* @category symbol
*/
export const DocTreeTypeId: unique symbol = internal.DocTreeTypeId as DocTreeTypeId
/**
* @since 1.0.0
* @category symbol
* @since 1.0.0
*/
export type TypeId = typeof TypeId
export type DocTreeTypeId = typeof DocTreeTypeId

@@ -38,5 +45,4 @@ /**

*
* @since 1.0.0
* @category model
* @since 1.0.0
* @tsplus type effect/printer/DocTree
*/

@@ -51,3 +57,12 @@ export type DocTree<A> =

/**
* @since 1.0.0
*/
export declare namespace DocTree {
export interface Variance<A> extends Equal {
readonly [DocTreeTypeId]: {
readonly _A: (_: never) => A
}
}
export type TypeLambda = DocTreeTypeLambda

@@ -57,17 +72,5 @@ }

/**
* @since 1.0.0
* @category model
* @since 1.0.0
* @tsplus type effect/printer/DocTree.Ops
*/
export interface DocTreeOps {
$: DocTreeAspects
}
/**
* @category instances
* @since 1.0.0
*/
export const DocTree: DocTreeOps = {
$: {}
}
export interface DocTreeTypeLambda extends TypeLambda {

@@ -78,26 +81,15 @@ readonly type: DocTree<this["Target"]>

/**
* @category model
* @since 1.0.0
* @tsplus type effect/printer/DocTree.Aspects
*/
export interface DocTreeAspects {}
/**
* @category model
* @since 1.0.0
*/
export interface EmptyTree<A> {
export interface EmptyTree<A> extends DocTree.Variance<A> {
readonly _tag: "EmptyTree"
readonly _id: TypeId
readonly _A: (_: never) => A
}
/**
* @since 1.0.0
* @category model
* @since 1.0.0
*/
export interface CharTree<A> {
export interface CharTree<A> extends DocTree.Variance<A> {
readonly _tag: "CharTree"
readonly _id: TypeId
readonly _A: (_: never) => A
readonly char: string

@@ -107,9 +99,7 @@ }

/**
* @since 1.0.0
* @category model
* @since 1.0.0
*/
export interface TextTree<A> {
export interface TextTree<A> extends DocTree.Variance<A> {
readonly _tag: "TextTree"
readonly _id: TypeId
readonly _A: (_: never) => A
readonly text: string

@@ -119,9 +109,7 @@ }

/**
* @since 1.0.0
* @category model
* @since 1.0.0
*/
export interface LineTree<A> {
export interface LineTree<A> extends DocTree.Variance<A> {
readonly _tag: "LineTree"
readonly _id: TypeId
readonly _A: (_: never) => A
readonly indentation: number

@@ -131,9 +119,7 @@ }

/**
* @since 1.0.0
* @category model
* @since 1.0.0
*/
export interface AnnotationTree<A> {
export interface AnnotationTree<A> extends DocTree.Variance<A> {
readonly _tag: "AnnotationTree"
readonly _id: TypeId
readonly _A: (_: never) => A
readonly annotation: A

@@ -144,9 +130,7 @@ readonly tree: DocTree<A>

/**
* @since 1.0.0
* @category model
* @since 1.0.0
*/
export interface ConcatTree<A> {
export interface ConcatTree<A> extends DocTree.Variance<A> {
readonly _tag: "ConcatTree"
readonly _id: TypeId
readonly _A: (_: never) => A
readonly trees: Chunk<DocTree<A>>

@@ -162,7 +146,6 @@ }

*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus static effect/printer/DocTree.Ops isDocTree
*/
export const isDocTree: (u: unknown) => u is DocTree<unknown> = DT.isDocTree
export const isDocTree: (u: unknown) => u is DocTree<unknown> = internal.isDocTree

@@ -172,7 +155,6 @@ /**

*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus fluent effect/printer/DocTree isEmptyTree
*/
export const isEmptyTree: <A>(self: DocTree<A>) => self is EmptyTree<A> = DT.isEmptyTree
export const isEmptyTree: <A>(self: DocTree<A>) => self is EmptyTree<A> = internal.isEmptyTree

@@ -182,7 +164,6 @@ /**

*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus fluent effect/printer/DocTree isCharTree
*/
export const isCharTree: <A>(self: DocTree<A>) => self is CharTree<A> = DT.isCharTree
export const isCharTree: <A>(self: DocTree<A>) => self is CharTree<A> = internal.isCharTree

@@ -192,7 +173,6 @@ /**

*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus fluent effect/printer/DocTree isTextTree
*/
export const isTextTree: <A>(self: DocTree<A>) => self is DT.TextTree<A> = DT.isTextTree
export const isTextTree: <A>(self: DocTree<A>) => self is TextTree<A> = internal.isTextTree

@@ -202,7 +182,6 @@ /**

*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus fluent effect/printer/DocTree isLineTree
*/
export const isLineTree: <A>(self: DocTree<A>) => self is DT.LineTree<A> = DT.isLineTree
export const isLineTree: <A>(self: DocTree<A>) => self is LineTree<A> = internal.isLineTree

@@ -212,7 +191,6 @@ /**

*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus fluent effect/printer/DocTree isAnnotationTree
*/
export const isAnnotationTree: <A>(self: DocTree<A>) => self is DT.AnnotationTree<A> = DT.isAnnotationTree
export const isAnnotationTree: <A>(self: DocTree<A>) => self is AnnotationTree<A> = internal.isAnnotationTree

@@ -222,7 +200,6 @@ /**

*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus fluent effect/printer/DocTree isConcatTree
*/
export const isConcatTree: <A>(self: DocTree<A>) => self is DT.ConcatTree<A> = DT.isConcatTree
export const isConcatTree: <A>(self: DocTree<A>) => self is ConcatTree<A> = internal.isConcatTree

@@ -234,28 +211,24 @@ // -----------------------------------------------------------------------------

/**
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/DocTree.Ops empty
*/
export const empty: DocTree<never> = DT.empty
export const empty: DocTree<never> = internal.empty
/**
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/DocTree.Ops char
*/
export const char: <A>(char: string) => DocTree<A> = DT.char
export const char: <A>(char: string) => DocTree<A> = internal.char
/**
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/DocTree.Ops text
*/
export const text: <A>(text: string) => DocTree<A> = DT.text
export const text: <A>(text: string) => DocTree<A> = internal.text
/**
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/DocTree.Ops line
*/
export const line: <A>(indentation: number) => DocTree<A> = DT.line
export const line: <A>(indentation: number) => DocTree<A> = internal.line

@@ -265,7 +238,9 @@ /**

*
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/DocTree.Ops annotation
*/
export const annotation: <A>(annotation: A) => (self: DocTree<A>) => DocTree<A> = DT.annotation
export const annotation: {
<A>(annotation: A): <B>(self: DocTree<B>) => DocTree<A | B>
<A, B>(self: DocTree<A>, annotation: B): DocTree<A | B>
} = internal.annotation

@@ -275,7 +250,6 @@ /**

*
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/DocTree.Ops concat
*/
export const concat: <A>(trees: Chunk<DocTree<A>>) => DocTree<A> = DT.concat
export const concat: <A>(trees: Chunk<DocTree<A>>) => DocTree<A> = internal.concat

@@ -290,12 +264,9 @@ // -----------------------------------------------------------------------------

*
* @since 1.0.0
* @category annotations
* @since 1.0.0
* @tsplus static effect/printer/DocTree.Aspects alterAnnotations
* @tsplus pipeable effect/printer/DocTree alterAnnotations
*/
export const alterAnnotations: <A, B>(
f: (a: A) => Iterable<B>
) => (
self: DocTree<A>
) => DocTree<B> = DT.alterAnnotations
export const alterAnnotations: {
<A, B>(f: (a: A) => Iterable<B>): (self: DocTree<A>) => DocTree<B>
<A, B>(self: DocTree<A>, f: (a: A) => Iterable<B>): DocTree<B>
} = internal.alterAnnotations

@@ -305,10 +276,9 @@ /**

*
* @since 1.0.0
* @category annotations
* @since 1.0.0
* @tsplus static effect/printer/DocTree.Aspects map
* @tsplus pipeable effect/printer/DocTree map
* @tsplus static effect/printer/DocTree.Aspects reAnnotate
* @tsplus pipeable effect/printer/DocTree reAnnotate
*/
export const reAnnotate: <A, B>(f: (a: A) => B) => (self: DocTree<A>) => DocTree<B> = DT.reAnnotate
export const reAnnotate: {
<A, B>(f: (a: A) => B): (self: DocTree<A>) => DocTree<B>
<A, B>(self: DocTree<A>, f: (a: A) => B): DocTree<B>
} = internal.reAnnotate

@@ -318,8 +288,6 @@ /**

*
* @since 1.0.0
* @category annotations
* @since 1.0.0
* @tsplus static effect/printer/DocTree.Aspects unAnnotate
* @tsplus getter effect/printer/DocTree unAnnotate
*/
export const unAnnotate: <A>(self: DocTree<A>) => DocTree<never> = DT.unAnnotate
export const unAnnotate: <A>(self: DocTree<A>) => DocTree<never> = internal.unAnnotate

@@ -331,13 +299,9 @@ // -----------------------------------------------------------------------------

/**
* @since 1.0.0
* @category folding
* @since 1.0.0
* @tsplus static effect/printer/DocTree.Aspects foldMap
* @tsplus pipeable effect/printer/DocTree foldMap
*/
export const foldMap: <A, M>(
I: Monoid<M>,
f: (a: A) => M
) => (
self: DocTree<A>
) => M = DT.foldMap
export const foldMap: {
<A, M>(M: monoid.Monoid<M>, f: (a: A) => M): (self: DocTree<A>) => M
<A, M>(self: DocTree<A>, M: monoid.Monoid<M>, f: (a: A) => M): M
} = internal.foldMap

@@ -358,4 +322,4 @@ // -----------------------------------------------------------------------------

* import * as Layout from "@effect/printer/Layout"
* import { identity, pipe } from "@fp-ts/data/Function"
* import * as String from "@fp-ts/data/String"
* import { identity, pipe } from "@effect/data/Function"
* import * as String from "@effect/data/String"
*

@@ -383,12 +347,18 @@ * const doc: Doc.Doc<void> = Doc.hsep([

*
* @since 1.0.0
* @category rendering
* @since 1.0.0
* @tsplus static effect/printer/DocTree.Aspects renderSimplyDecorated
* @tsplus pipeable effect/printer/DocTree renderSimplyDecorated
*/
export const renderSimplyDecorated: <A, M>(
M: Monoid<M>,
renderText: (text: string) => M,
renderAnnotation: (annotation: A, out: M) => M
) => (self: DocTree<A>) => M = DT.renderSimplyDecorated
export const renderSimplyDecorated: {
<A, M>(
M: monoid.Monoid<M>,
renderText: (text: string) => M,
renderAnnotation: (annotation: A, out: M) => M
): (self: DocTree<A>) => M
<A, M>(
self: DocTree<A>,
M: monoid.Monoid<M>,
renderText: (text: string) => M,
renderAnnotation: (annotation: A, out: M) => M
): M
} = internal.renderSimplyDecorated

@@ -407,3 +377,3 @@ // -----------------------------------------------------------------------------

*/
export const treeForm: <A>(stream: DocStream<A>) => DocTree<A> = DT.treeForm
export const treeForm: <A>(stream: DocStream.DocStream<A>) => DocTree<A> = internal.treeForm

@@ -415,20 +385,23 @@ // -----------------------------------------------------------------------------

/**
* @since 1.0.0
* @category instances
*/
export const getSemigroup: <A>(_: void) => semigroup.Semigroup<DocTree<A>> = internal.getSemigroup
/**
* @since 1.0.0
* @tsplus static effect/printer/DocTree.Ops getSemigroup
* @category instances
*/
export const getSemigroup: <A>() => Semigroup<DocTree<A>> = DT.getSemigroup
export const getMonoid: <A>(_: void) => monoid.Monoid<DocTree<A>> = internal.getMonoid
/**
* @since 1.0.0
* @category instances
* @since 1.0.0
* @tsplus static effect/printer/DocTree.Ops getMonoid
*/
export const getMonoid: <A>() => Monoid<DocTree<A>> = DT.getMonoid
export const Covariant: covariant.Covariant<DocTree.TypeLambda> = internal.Covariant
/**
* @since 1.0.0
* @category instances
* @since 1.0.0
* @tsplus static effect/printer/DocTree.Ops Covariant
*/
export const Functor: _Functor<DocTree.TypeLambda> = DT.Functor
export const Invariant: invariant.Invariant<DocTree.TypeLambda> = internal.Invariant

@@ -5,17 +5,18 @@ /**

import * as F from "@effect/printer/internal/Flatten"
import type { TypeLambda } from "@fp-ts/core/HKT"
import type { Covariant as _Functor } from "@fp-ts/core/typeclass/Covariant"
import type { Equal } from "@effect/data/Equal"
import type { TypeLambda } from "@effect/data/HKT"
import type { Covariant as _Functor } from "@effect/data/typeclass/Covariant"
import * as internal from "@effect/printer/internal_effect_untraced/flatten"
// -----------------------------------------------------------------------------
// Models
// -----------------------------------------------------------------------------
/**
* @since 1.0.0
* @category symbol
*/
export const FlattenTypeId: unique symbol = internal.FlattenTypeId as FlattenTypeId
const TypeId: unique symbol = F.FlattenTypeId as TypeId
/**
* @since 1.0.0
* @category symbol
* @since 1.0.0
*/
export type TypeId = typeof TypeId
export type FlattenTypeId = typeof FlattenTypeId

@@ -29,5 +30,4 @@ /**

*
* @since 1.0.0
* @category model
* @since 1.0.0
* @tsplus type effect/printer/Flatten
*/

@@ -40,2 +40,12 @@ export type Flatten<A> = Flattened<A> | AlreadyFlat<A> | NeverFlat<A>

export declare namespace Flatten {
/**
* @since 1.0.0
* @category model
*/
export interface Variance<A> extends Equal {
readonly [FlattenTypeId]: {
readonly _A: (_: never) => A
}
}
export type TypeLambda = FlattenTypeLambda

@@ -45,20 +55,4 @@ }

/**
* @category model
* @since 1.0.0
* @tsplus type effect/printer/Flatten.Ops
*/
export interface FlattenOps {
$: FlattenAspects
}
/**
* @category instances
* @since 1.0.0
*/
export const Flatten: FlattenOps = {
$: {}
}
/**
* @category model
* @since 1.0.0
*/

@@ -70,18 +64,9 @@ export interface FlattenTypeLambda extends TypeLambda {

/**
* @category model
* @since 1.0.0
* @tsplus type effect/printer/Flatten.Aspects
*/
export interface FlattenAspects {}
/**
* Represents a `FlattenResult` where `A` is likely flatter than the input.
*
* @since 1.0.0
* @category model
* @since 1.0.0
*/
export interface Flattened<A> {
export interface Flattened<A> extends Flatten.Variance<A> {
readonly _tag: "Flattened"
readonly _id: TypeId
readonly _A: (_: never) => A
readonly value: A

@@ -93,9 +78,7 @@ }

*
* @since 1.0.0
* @category model
* @since 1.0.0
*/
export interface AlreadyFlat<A> {
export interface AlreadyFlat<A> extends Flatten.Variance<A> {
readonly _tag: "AlreadyFlat"
readonly _id: TypeId
readonly _A: (_: never) => A
}

@@ -106,9 +89,7 @@

*
* @since 1.0.0
* @category model
* @since 1.0.0
*/
export interface NeverFlat<A> {
export interface NeverFlat<A> extends Flatten.Variance<A> {
readonly _tag: "NeverFlat"
readonly _id: TypeId
readonly _A: (_: never) => A
}

@@ -123,7 +104,6 @@

*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus static effect/printer/Flatten.Ops isFlatten
*/
export const isFlatten: (u: unknown) => u is Flatten<unknown> = F.isFlatten
export const isFlatten: (u: unknown) => u is Flatten<unknown> = internal.isFlatten

@@ -133,7 +113,6 @@ /**

*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus fluent effect/printer/Flatten isFlattened
*/
export const isFlattened: <A>(a: Flatten<A>) => a is Flattened<A> = F.isFlattened
export const isFlattened: <A>(a: Flatten<A>) => a is Flattened<A> = internal.isFlattened

@@ -143,7 +122,6 @@ /**

*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus fluent effect/printer/Flatten isAlreadyFlat
*/
export const isAlreadyFlat: <A>(a: Flatten<A>) => a is AlreadyFlat<A> = F.isAlreadyFlat
export const isAlreadyFlat: <A>(a: Flatten<A>) => a is AlreadyFlat<A> = internal.isAlreadyFlat

@@ -153,7 +131,6 @@ /**

*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus fluent effect/printer/Flatten isNeverFlat
*/
export const isNeverFlat: <A>(a: Flatten<A>) => a is NeverFlat<A> = F.isNeverFlat
export const isNeverFlat: <A>(a: Flatten<A>) => a is NeverFlat<A> = internal.isNeverFlat

@@ -165,21 +142,18 @@ // -----------------------------------------------------------------------------

/**
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/Flatten.Ops Flattened
*/
export const flattened: <A>(value: A) => Flatten<A> = F.flattened
export const flattened: <A>(value: A) => Flatten<A> = internal.flattened
/**
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/Flatten.Ops AlreadyFlat
*/
export const alreadyFlat: Flatten<never> = F.alreadyFlat
export const alreadyFlat: Flatten<never> = internal.alreadyFlat
/**
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/Flatten.Ops NeverFlat
*/
export const neverFlat: Flatten<never> = F.neverFlat
export const neverFlat: Flatten<never> = internal.neverFlat

@@ -191,21 +165,10 @@ // -----------------------------------------------------------------------------

/**
* @since 1.0.0
* @category mapping
* @since 1.0.0
* @tsplus static effect/printer/Flatten.Aspects map
* @tsplus pipeable effect/printer/Flatten map
*/
export const map: <A, B>(f: (a: A) => B) => (self: Flatten<A>) => Flatten<B> = F.map
export const map: {
<A, B>(f: (a: A) => B): (self: Flatten<A>) => Flatten<B>
<A, B>(self: Flatten<A>, f: (a: A) => B): Flatten<B>
} = internal.map
/**
* @category folding
* @since 1.0.0
* @tsplus static effect/printer/Flatten.Aspects match
* @tsplus pipeable effect/printer/Flatten match
*/
export const match: <A, R>(patterns: {
readonly Flattened: (value: A) => R
readonly AlreadyFlat: () => R
readonly NeverFlat: () => R
}) => (flatten: Flatten<A>) => R = F.match
// -----------------------------------------------------------------------------

@@ -215,7 +178,6 @@ // Instances

/**
* @category instances
* @since 1.0.0
* @tsplus static effect/printer/Flatten.Ops Functor
*/
export const Functor: _Functor<Flatten.TypeLambda> = F.Functor
// /**
// * @since 1.0.0
// * @category instances
// */
// export const Functor: _Functor<Flatten.TypeLambda> = internal.Functor

@@ -5,5 +5,9 @@ /**

import * as L from "@effect/printer/internal/Layout"
import type { Option } from "@fp-ts/data/Option"
import type { Predicate } from "@fp-ts/data/Predicate"
import type { Option } from "@effect/data/Option"
import type { Predicate } from "@effect/data/Predicate"
import type { Doc } from "@effect/printer/Doc"
import type { DocStream } from "@effect/printer/DocStream"
import * as internal from "@effect/printer/internal_effect_untraced/layout"
import type { PageWidth } from "@effect/printer/PageWidth"
import { defaultPageWidth } from "@effect/printer/PageWidth"

@@ -15,5 +19,4 @@ // -----------------------------------------------------------------------------

/**
* @since 1.0.0
* @category model
* @since 1.0.0
* @tsplus type effect/printer/Layout
*/

@@ -31,5 +34,4 @@ export interface Layout<A> {

*
* @since 1.0.0
* @category model
* @since 1.0.0
* @tsplus type effect/printer/Layout.Options
*/

@@ -47,4 +49,4 @@ export interface Options {

*
* @since 1.0.0
* @category model
* @since 1.0.0
*/

@@ -59,51 +61,15 @@ export type FittingPredicate<A> = (

/**
* @category model
* @since 1.0.0
* @tsplus type effect/printer/Layout.Ops
*/
export interface LayoutOps {
readonly $: LayoutAspects
readonly Options: LayoutOptionsOps
}
/**
* @category model
* @since 1.0.0
* @tsplus type effect/printer/Layout.Options.Ops
*/
export interface LayoutOptionsOps {
(pageWidth: PageWidth): Layout.Options
}
/**
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/Layout.Ops Options
*/
export const LayoutOptions: LayoutOptionsOps = (pageWidth) => ({ pageWidth })
export const options: (pageWidth: PageWidth) => Layout.Options = internal.options
/**
* @category instances
* @since 1.0.0
*/
export const Layout: LayoutOps = {
$: {},
Options: LayoutOptions
}
/**
* @category model
* @since 1.0.0
* @tsplus type effect/printer/Layout.Aspects
*/
export interface LayoutAspects {}
/**
* The default layout options, which are suitable when you want to obtain output
* but do not care about the details.
*
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/Layout.Options.Ops default
*/
export const defaultLayoutOptions = LayoutOptions(PageWidth.default)
export const defaultOptions: Layout.Options = options(defaultPageWidth)

@@ -115,11 +81,9 @@ // -----------------------------------------------------------------------------

/**
* @since 1.0.0
* @category layout algorithms
* @since 1.0.0
* @tsplus static effect/printer/Doc.Aspects layoutWadlerLeijen
* @tsplus pipeable effect/printer/Doc layoutWadlerLeijen
*/
export const wadlerLeijen: <A>(
fits: Layout.FittingPredicate<A>,
options: Layout.Options
) => (self: Doc<A>) => DocStream<A> = L.wadlerLeijen
export const wadlerLeijen: {
<A>(fits: Layout.FittingPredicate<A>, options: Layout.Options): (self: Doc<A>) => DocStream<A>
<A>(self: Doc<A>, fits: Layout.FittingPredicate<A>, options: Layout.Options): DocStream<A>
} = internal.wadlerLeijen

@@ -137,4 +101,4 @@ /**

* import * as Render from "@effect/printer/Render"
* import { pipe } from "@fp-ts/data/Function"
* import * as String from "@fp-ts/data/String"
* import { pipe } from "@effect/data/Function"
* import * as String from "@effect/data/String"
*

@@ -173,8 +137,6 @@ * const doc = pipe(

*
* @since 1.0.0
* @category layout algorithms
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops layoutCompact
* @tsplus getter effect/printer/Doc layoutCompact
*/
export const compact: <A>(self: Doc<A>) => DocStream<A> = L.compact
export const compact: <A>(self: Doc<A>) => DocStream<A> = internal.compact

@@ -193,8 +155,9 @@ /**

*
* @tsplus static effect/printer/Doc.Aspects layoutPretty
* @tsplus pipeable effect/printer/Doc layoutPretty
* @since 1.0.0
* @category layout algorithms
*/
export const pretty: (
options: Layout.Options
) => <A>(self: Doc<A>) => DocStream<A> = L.pretty
export const pretty: {
(options: Layout.Options): <A>(self: Doc<A>) => DocStream<A>
<A>(self: Doc<A>, options: Layout.Options): DocStream<A>
} = internal.pretty

@@ -212,4 +175,4 @@ /**

* import * as Render from "@effect/printer/Render"
* import { flow, pipe } from "@fp-ts/data/Function"
* import * as String from "@fp-ts/data/String"
* import { flow, pipe } from "@effect/data/Function"
* import * as String from "@effect/data/String"
*

@@ -292,10 +255,9 @@ * // Consider the following python-ish document:

*
* @since 1.0.0
* @category layout algorithms
* @since 1.0.0
* @tsplus static effect/printer/Doc.Aspects layoutSmart
* @tsplus pipeable effect/printer/Doc layoutSmart
*/
export const smart: (
options: Layout.Options
) => <A>(self: Doc<A>) => DocStream<A> = L.smart
export const smart: {
(options: Layout.Options): <A>(self: Doc<A>) => DocStream<A>
<A>(self: Doc<A>, options: Layout.Options): DocStream<A>
} = internal.smart

@@ -306,7 +268,5 @@ /**

*
* @since 1.0.0
* @category layout algorithms
* @since 1.0.0
* @tsplus static effect/printer/Doc.Ops layoutUnbounded
* @tsplus getter effect/printer/Doc layoutUnbounded
*/
export const unbounded: <A>(self: Doc<A>) => DocStream<A> = L.unbounded
export const unbounded: <A>(self: Doc<A>) => DocStream<A> = internal.unbounded

@@ -5,3 +5,4 @@ /**

import * as O from "@effect/printer/internal/Optimize"
import type { Doc } from "@effect/printer/Doc"
import * as internal from "@effect/printer/internal_effect_untraced/optimize"

@@ -16,5 +17,4 @@ // -----------------------------------------------------------------------------

*
* @since 1.0.0
* @category model
* @since 1.0.0
* @tsplus type effect/printer/Optimize
*/

@@ -26,21 +26,4 @@ export interface Optimize<A> {

/**
* @category model
* @since 1.0.0
* @tsplus type effect/printer/Optimize.Ops
*/
export interface OptimizeOps {
readonly $: OptimizeAspects
readonly Depth: FusionDepthOps
}
/**
* @category model
* @since 1.0.0
* @tsplus type effect/printer/Optimize.Aspects
*/
export interface OptimizeAspects {}
/**
* @since 1.0.0
*/
export declare namespace Optimize {

@@ -54,5 +37,4 @@ export type Depth = FusionDepth

*
* @since 1.0.0
* @category model
* @since 1.0.0
* @tsplus type effect/printer/Optimize.Depth
*/

@@ -62,29 +44,7 @@ export type FusionDepth = Shallow | Deep

/**
* @category model
* @since 1.0.0
* @tsplus type effect/printer/Optimize.Depth.Ops
*/
export interface FusionDepthOps {}
/**
* @category instances
* @since 1.0.0
*/
export const FusionDepth: FusionDepthOps = {}
/**
* @category instances
* @since 1.0.0
*/
export const Optimize: OptimizeOps = {
$: {},
Depth: FusionDepth
}
/**
* Instructs the document fusion optimizer to avoid diving deeply into nested
* documents, fusing mostly concatenations of text nodes together.
*
* @since 1.0.0
* @category model
* @since 1.0.0
*/

@@ -107,4 +67,4 @@ export interface Shallow {

*
* @since 1.0.0
* @category model
* @since 1.0.0
*/

@@ -116,5 +76,4 @@ export interface Deep {

/**
* @since 1.0.0
* @category instances
* @since 1.0.0
* @tsplus static effect/printer/Optimize.Depth.Ops Shallow
*/

@@ -126,5 +85,4 @@ export const Shallow: FusionDepth = {

/**
* @since 1.0.0
* @category instances
* @since 1.0.0
* @tsplus static effect/printer/Optimize.Depth.Ops Deep
*/

@@ -171,7 +129,8 @@ export const Deep: FusionDepth = {

*
* @since 1.0.0
* @category optimization
* @since 1.0.0
* @tsplus static effect/printer/Doc.Aspects optimize
* @tsplus pipeable effect/printer/Doc optimize
*/
export const optimize: <A>(depth: FusionDepth) => (self: Doc<A>) => Doc<A> = O.optimize
export const optimize: {
(depth: FusionDepth): <A>(self: Doc<A>) => Doc<A>
<A>(self: Doc<A>, depth: FusionDepth): Doc<A>
} = internal.optimize

@@ -5,4 +5,4 @@ /**

import * as PW from "@effect/printer/internal/PageWidth"
import type * as Equal from "@fp-ts/data/Equal"
import type { Equal } from "@effect/data/Equal"
import * as internal from "@effect/printer/internal_effect_untraced/pageWidth"

@@ -13,9 +13,13 @@ // -----------------------------------------------------------------------------

const TypeId: unique symbol = PW.PageWidthTypeId as TypeId
/**
* @since 1.0.0
* @category symbol
*/
export const PageWidthTypeId: unique symbol = internal.PageWidthTypeId as PageWidthTypeId
/**
* @since 1.0.0
* @category symbol
* @since 1.0.0
*/
export type TypeId = typeof TypeId
export type PageWidthTypeId = typeof PageWidthTypeId

@@ -27,5 +31,4 @@ /**

*
* @since 1.0.0
* @category model
* @since 1.0.0
* @tsplus type effect/printer/PageWidth
*/

@@ -35,11 +38,23 @@ export type PageWidth = AvailablePerLine | Unbounded

/**
* @since 1.0.0
*/
export declare namespace PageWidth {
/**
* @since 1.0.0
* @category model
*/
export interface Proto extends Equal {
readonly [PageWidthTypeId]: PageWidthTypeId
}
}
/**
* Represents a `PageWidth` setting that informs the layout algorithms to avoid
* exceeding the specified space per line.
*
* @since 1.0.0
* @category model
* @since 1.0.0
*/
export interface AvailablePerLine extends Equal.Equal {
export interface AvailablePerLine extends PageWidth.Proto {
readonly _tag: "AvailablePerLine"
readonly _id: TypeId
/**

@@ -62,25 +77,9 @@ * The number of characters, including whitespace, that can fit on a single

*
* @since 1.0.0
* @category model
* @since 1.0.0
*/
export interface Unbounded extends Equal.Equal {
export interface Unbounded extends PageWidth.Proto {
readonly _tag: "Unbounded"
readonly _id: TypeId
}
/**
* @category model
* @since 1.0.0
* @tsplus type effect/printer/PageWidth.Ops
*/
export interface PageWidthOps {}
export const PageWidth: PageWidthOps = {}
/**
* @category model
* @since 1.0.0
* @tsplus type effect/printer/PageWidth/Aspects
*/
export interface PageWidthAspects {}
// -----------------------------------------------------------------------------

@@ -93,7 +92,6 @@ // Refinements

*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus static effect/printer/PageWidth.Ops isPageWidth
*/
export const isPageWidth: (u: unknown) => u is PageWidth = PW.isPageWidth
export const isPageWidth: (u: unknown) => u is PageWidth = internal.isPageWidth

@@ -104,7 +102,6 @@ /**

*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus fluent effect/printer/PageWidth isAvailablePerLine
*/
export const isAvailablePerLine: (self: PageWidth) => self is AvailablePerLine = PW.isAvailablePerLine
export const isAvailablePerLine: (self: PageWidth) => self is AvailablePerLine = internal.isAvailablePerLine

@@ -115,7 +112,6 @@ /**

*
* @since 1.0.0
* @category refinements
* @since 1.0.0
* @tsplus fluent effect/printer/PageWidth isUnbounded
*/
export const isUnbounded: (self: PageWidth) => self is Unbounded = PW.isUnbounded
export const isUnbounded: (self: PageWidth) => self is Unbounded = internal.isUnbounded

@@ -127,24 +123,18 @@ // -----------------------------------------------------------------------------

/**
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/PageWidth.Ops AvailablePerLine
*/
export const availablePerLine: (
lineWidth: number,
ribbonFraction: number
) => PageWidth = PW.availablePerLine
export const availablePerLine: (lineWidth: number, ribbonFraction: number) => PageWidth = internal.availablePerLine
/**
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/PageWidth.Ops Unbounded
*/
export const unbounded: PageWidth = PW.unbounded
export const unbounded: PageWidth = internal.unbounded
/**
* @since 1.0.0
* @category constructors
* @since 1.0.0
* @tsplus static effect/printer/PageWidth.Ops default
*/
export const defaultPageWidth = PW.availablePerLine(80, 1)
export const defaultPageWidth: PageWidth = internal.defaultPageWidth

@@ -158,5 +148,4 @@ // -----------------------------------------------------------------------------

*
* @since 1.0.0
* @category utilities
* @since 1.0.0
* @tsplus static effect/printer/PageWidth.Ops remainingWidth
*/

@@ -168,2 +157,2 @@ export const remainingWidth: (

currentColumn: number
) => number = PW.remainingWidth
) => number = internal.remainingWidth

@@ -5,3 +5,6 @@ /**

import * as R from "@effect/printer/internal/Render"
import type { Doc } from "@effect/printer/Doc"
import type { DocStream } from "@effect/printer/DocStream"
import * as internal from "@effect/printer/internal_effect_untraced/render"
import type { AvailablePerLine } from "@effect/printer/PageWidth"

@@ -18,53 +21,53 @@ // -----------------------------------------------------------------------------

*
* @tsplus static effect/printer/DocStream.Ops render
* @tsplus getter effect/printer/DocStream render
* @since 1.0.0
* @category rendering
*/
export const render: <A>(self: DocStream<A>) => string = R.render
export const render: <A>(self: DocStream<A>) => string = internal.render
/**
* @tsplus static effect/printer/Doc.Ops compact
* @tsplus getter effect/printer/Doc compact
* @since 1.0.0
* @category rendering
*/
export const compact: <A>(self: Doc<A>) => string = R.compact
export const compact: <A>(self: Doc<A>) => string = internal.compact
/**
* @tsplus static effect/printer/Doc.Aspects pretty
* @tsplus pipeable effect/printer/Doc pretty
* @since 1.0.0
* @category rendering
*/
export const pretty: (
lineWidth: number,
ribbonFraction?: number
) => <A>(self: Doc<A>) => string = R.pretty
export const pretty: {
(options: Partial<Omit<AvailablePerLine, "_tag">>): <A>(self: Doc<A>) => string
<A>(self: Doc<A>, options: Partial<Omit<AvailablePerLine, "_tag">>): string
} = internal.pretty
/**
* @tsplus static effect/printer/Doc.Ops prettyDefault
* @tsplus getter effect/printer/Doc prettyDefault
* @since 1.0.0
* @category rendering
*/
export const prettyDefault: <A>(self: Doc<A>) => string = R.prettyDefault
export const prettyDefault: <A>(self: Doc<A>) => string = internal.prettyDefault
/**
* @tsplus static effect/printer/Doc.Ops prettyUnbounded
* @tsplus getter effect/printer/Doc prettyUnbounded
* @since 1.0.0
* @category rendering
*/
export const prettyUnbounded: <A>(self: Doc<A>) => string = R.prettyUnbounded
export const prettyUnbounded: <A>(self: Doc<A>) => string = internal.prettyUnbounded
/**
* @tsplus static effect/printer/Doc.Aspects smart
* @tsplus pipeable effect/printer/Doc smart
* @since 1.0.0
* @category rendering
*/
export const smart: <A>(
lineWidth: number,
ribbonFraction?: number
) => (self: Doc<A>) => string = R.smart
export const smart: {
(options: Partial<Omit<AvailablePerLine, "_tag">>): <A>(self: Doc<A>) => string
<A>(self: Doc<A>, options: Partial<Omit<AvailablePerLine, "_tag">>): string
} = internal.smart
/**
* @tsplus static effect/printer/Doc.Ops smartDefault
* @tsplus getter effect/printer/Doc smartDefault
* @since 1.0.0
* @category rendering
*/
export const smartDefault: <A>(self: Doc<A>) => string = R.smartDefault
export const smartDefault: <A>(self: Doc<A>) => string = internal.smartDefault
/**
* @tsplus static effect/printer/Doc.Ops smartUnbounded
* @tsplus getter effect/printer/Doc smartUnbounded
* @since 1.0.0
* @category rendering
*/
export const smartUnbounded: <A>(self: Doc<A>) => string = R.smartUnbounded
export const smartUnbounded: <A>(self: Doc<A>) => string = internal.smartUnbounded

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc