@effect/printer
Advanced tools
Comparing version 0.29.0 to 0.30.0
{ | ||
"name": "@effect/printer", | ||
"version": "0.29.0", | ||
"description": "Functional programming in TypeScript", | ||
"version": "0.30.0", | ||
"description": "Unified interfaces for common platform-specific services", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/Effect-TS/printer.git" | ||
"url": "https://github.com/effect-ts/effect.git" | ||
}, | ||
"sideEffects": [], | ||
"author": "Michael Arnaldi <ma@matechs.com>", | ||
"peerDependencies": { | ||
"@effect/typeclass": "^0.21.0", | ||
"effect": "2.0.0-next.62" | ||
"@effect/typeclass": "^0.22.0", | ||
"effect": "^2.0.0" | ||
}, | ||
@@ -16,0 +15,0 @@ "main": "./dist/cjs/index.js", |
@@ -1,4 +0,1 @@ | ||
[![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) | ||
# Pretty Printer for Effect-TS | ||
@@ -5,0 +2,0 @@ |
@@ -1892,4 +1892,3 @@ /** | ||
*/ | ||
export const changesUponFlattening: <A>(self: Doc<A>) => Flatten<Doc<A>> = | ||
internal.changesUponFlattening | ||
export const changesUponFlattening: <A>(self: Doc<A>) => Flatten<Doc<A>> = internal.changesUponFlattening | ||
@@ -1896,0 +1895,0 @@ // ----------------------------------------------------------------------------- |
@@ -179,4 +179,3 @@ /** | ||
*/ | ||
export const isFailedStream: <A>(self: DocStream<A>) => self is FailedStream<A> = | ||
internal.isFailedStream | ||
export const isFailedStream: <A>(self: DocStream<A>) => self is FailedStream<A> = internal.isFailedStream | ||
@@ -189,4 +188,3 @@ /** | ||
*/ | ||
export const isEmptyStream: <A>(self: DocStream<A>) => self is EmptyStream<A> = | ||
internal.isEmptyStream | ||
export const isEmptyStream: <A>(self: DocStream<A>) => self is EmptyStream<A> = internal.isEmptyStream | ||
@@ -193,0 +191,0 @@ /** |
@@ -183,4 +183,3 @@ /** | ||
*/ | ||
export const isAnnotationTree: <A>(self: DocTree<A>) => self is AnnotationTree<A> = | ||
internal.isAnnotationTree | ||
export const isAnnotationTree: <A>(self: DocTree<A>) => self is AnnotationTree<A> = internal.isAnnotationTree | ||
@@ -187,0 +186,0 @@ /** |
@@ -22,10 +22,7 @@ import * as covariant from "@effect/typeclass/Covariant" | ||
const protoHash = { | ||
Fail: (_: Doc.Fail<any>) => | ||
Hash.combine(Hash.hash(DocSymbolKey))(Hash.hash("@effect/printer/Doc/Fail")), | ||
Empty: (_: Doc.Empty<any>) => | ||
Hash.combine(Hash.hash(DocSymbolKey))(Hash.hash("@effect/printer/Doc/Empty")), | ||
Fail: (_: Doc.Fail<any>) => Hash.combine(Hash.hash(DocSymbolKey))(Hash.hash("@effect/printer/Doc/Fail")), | ||
Empty: (_: Doc.Empty<any>) => Hash.combine(Hash.hash(DocSymbolKey))(Hash.hash("@effect/printer/Doc/Empty")), | ||
Char: (self: Doc.Char<any>) => Hash.combine(Hash.hash(DocSymbolKey))(Hash.string(self.char)), | ||
Text: (self: Doc.Text<any>) => Hash.combine(Hash.hash(DocSymbolKey))(Hash.string(self.text)), | ||
Line: (_: Doc.Line<any>) => | ||
Hash.combine(Hash.hash(DocSymbolKey))(Hash.hash("@effect/printer/Doc/Line")), | ||
Line: (_: Doc.Line<any>) => Hash.combine(Hash.hash(DocSymbolKey))(Hash.hash("@effect/printer/Doc/Line")), | ||
FlatAlt: (self: Doc.FlatAlt<any>) => | ||
@@ -48,4 +45,3 @@ Hash.combine(Hash.hash(DocSymbolKey))( | ||
Column: (self: Doc.Column<any>) => Hash.combine(Hash.hash(DocSymbolKey))(Hash.hash(self.react)), | ||
WithPageWidth: (self: Doc.WithPageWidth<any>) => | ||
Hash.combine(Hash.hash(DocSymbolKey))(Hash.hash(self.react)), | ||
WithPageWidth: (self: Doc.WithPageWidth<any>) => Hash.combine(Hash.hash(DocSymbolKey))(Hash.hash(self.react)), | ||
Nesting: (self: Doc.Nesting<any>) => Hash.combine(Hash.hash(DocSymbolKey))(Hash.hash(self.react)), | ||
@@ -61,6 +57,4 @@ Annotated: (self: Doc.Annotated<any>) => | ||
Empty: (_: Doc.Empty<any>, that: unknown) => isDoc(that) && that._tag === "Empty", | ||
Char: (self: Doc.Char<any>, that: unknown) => | ||
isDoc(that) && that._tag === "Char" && self.char === that.char, | ||
Text: (self: Doc.Text<any>, that: unknown) => | ||
isDoc(that) && that._tag === "Text" && self.text === that.text, | ||
Char: (self: Doc.Char<any>, that: unknown) => isDoc(that) && that._tag === "Char" && self.char === that.char, | ||
Text: (self: Doc.Text<any>, that: unknown) => isDoc(that) && that._tag === "Text" && self.text === that.text, | ||
Line: (_: Doc.Line<any>, that: unknown) => isDoc(that) && that._tag === "Line", | ||
@@ -124,4 +118,3 @@ FlatAlt: (self: Doc.FlatAlt<any>, that: unknown) => | ||
/** @internal */ | ||
export const isDoc = (u: unknown): u is Doc.Doc<unknown> => | ||
typeof u === "object" && u != null && DocTypeId in u | ||
export const isDoc = (u: unknown): u is Doc.Doc<unknown> => typeof u === "object" && u != null && DocTypeId in u | ||
@@ -159,4 +152,3 @@ /** @internal */ | ||
/** @internal */ | ||
export const isWithPageWidth = <A>(self: Doc.Doc<A>): self is Doc.WithPageWidth<A> => | ||
self._tag === "WithPageWidth" | ||
export const isWithPageWidth = <A>(self: Doc.Doc<A>): self is Doc.WithPageWidth<A> => self._tag === "WithPageWidth" | ||
@@ -167,4 +159,3 @@ /** @internal */ | ||
/** @internal */ | ||
export const isAnnotated = <A>(self: Doc.Doc<A>): self is Doc.Annotated<A> => | ||
self._tag === "Annotated" | ||
export const isAnnotated = <A>(self: Doc.Doc<A>): self is Doc.Annotated<A> => self._tag === "Annotated" | ||
@@ -374,4 +365,3 @@ // ----------------------------------------------------------------------------- | ||
/** @internal */ | ||
export const hcat = <A>(docs: Iterable<Doc.Doc<A>>): Doc.Doc<A> => | ||
concatWith(docs, (left, right) => cat(left, right)) | ||
export const hcat = <A>(docs: Iterable<Doc.Doc<A>>): Doc.Doc<A> => concatWith(docs, (left, right) => cat(left, right)) | ||
@@ -859,4 +849,3 @@ /** @internal */ | ||
/** @internal */ | ||
export const squareBracketed = <A>(self: Doc.Doc<A>): Doc.Doc<A> => | ||
surround(self, lbracket, rbracket) | ||
export const squareBracketed = <A>(self: Doc.Doc<A>): Doc.Doc<A> => surround(self, lbracket, rbracket) | ||
@@ -878,4 +867,3 @@ /** @internal */ | ||
/** @internal */ | ||
export const words = (s: string, char = " "): ReadonlyArray<Doc.Doc<never>> => | ||
s.split(char).map(string) | ||
export const words = (s: string, char = " "): ReadonlyArray<Doc.Doc<never>> => s.split(char).map(string) | ||
@@ -882,0 +870,0 @@ /** @internal */ |
@@ -70,6 +70,4 @@ import * as covariant from "@effect/typeclass/Covariant" | ||
const protoEqual = { | ||
FailedStream: (self: DocStream.FailedStream<any>, that: unknown) => | ||
isDocStream(that) && that._tag === "FailedStream", | ||
EmptyStream: (self: DocStream.EmptyStream<any>, that: unknown) => | ||
isDocStream(that) && that._tag === "EmptyStream", | ||
FailedStream: (self: DocStream.FailedStream<any>, that: unknown) => isDocStream(that) && that._tag === "FailedStream", | ||
EmptyStream: (self: DocStream.EmptyStream<any>, that: unknown) => isDocStream(that) && that._tag === "EmptyStream", | ||
CharStream: (self: DocStream.CharStream<any>, that: unknown) => | ||
@@ -267,5 +265,3 @@ isDocStream(that) && | ||
return Effect.map( | ||
Effect.suspend(() => | ||
alterAnnotationSafe(self.stream, f, List.prepend(stack, DontRemove)) | ||
), | ||
Effect.suspend(() => alterAnnotationSafe(self.stream, f, List.prepend(stack, DontRemove))), | ||
pushAnnotation(altered.value) | ||
@@ -272,0 +268,0 @@ ) |
@@ -67,4 +67,3 @@ import * as covariant from "@effect/typeclass/Covariant" | ||
const protoEqual = { | ||
EmptyTree: (_: DocTree.EmptyTree<any>, that: unknown) => | ||
isDocTree(that) && that._tag === "EmptyTree", | ||
EmptyTree: (_: DocTree.EmptyTree<any>, that: unknown) => isDocTree(that) && that._tag === "EmptyTree", | ||
CharTree: (self: DocTree.CharTree<any>, that: unknown) => | ||
@@ -106,16 +105,12 @@ isDocTree(that) && that._tag === "CharTree" && self.char === that.char, | ||
/** @internal */ | ||
export const isEmptyTree = <A>(self: DocTree.DocTree<A>): self is DocTree.EmptyTree<A> => | ||
self._tag === "EmptyTree" | ||
export const isEmptyTree = <A>(self: DocTree.DocTree<A>): self is DocTree.EmptyTree<A> => self._tag === "EmptyTree" | ||
/** @internal */ | ||
export const isCharTree = <A>(self: DocTree.DocTree<A>): self is DocTree.CharTree<A> => | ||
self._tag === "CharTree" | ||
export const isCharTree = <A>(self: DocTree.DocTree<A>): self is DocTree.CharTree<A> => self._tag === "CharTree" | ||
/** @internal */ | ||
export const isTextTree = <A>(self: DocTree.DocTree<A>): self is DocTree.TextTree<A> => | ||
self._tag === "TextTree" | ||
export const isTextTree = <A>(self: DocTree.DocTree<A>): self is DocTree.TextTree<A> => self._tag === "TextTree" | ||
/** @internal */ | ||
export const isLineTree = <A>(self: DocTree.DocTree<A>): self is DocTree.LineTree<A> => | ||
self._tag === "LineTree" | ||
export const isLineTree = <A>(self: DocTree.DocTree<A>): self is DocTree.LineTree<A> => self._tag === "LineTree" | ||
@@ -127,4 +122,3 @@ /** @internal */ | ||
/** @internal */ | ||
export const isConcatTree = <A>(self: DocTree.DocTree<A>): self is DocTree.ConcatTree<A> => | ||
self._tag === "ConcatTree" | ||
export const isConcatTree = <A>(self: DocTree.DocTree<A>): self is DocTree.ConcatTree<A> => self._tag === "ConcatTree" | ||
@@ -236,4 +230,3 @@ // ----------------------------------------------------------------------------- | ||
/** @internal */ | ||
export const unAnnotate = <A>(self: DocTree.DocTree<A>): DocTree.DocTree<never> => | ||
alterAnnotations(self, () => []) | ||
export const unAnnotate = <A>(self: DocTree.DocTree<A>): DocTree.DocTree<never> => alterAnnotations(self, () => []) | ||
@@ -389,12 +382,10 @@ // ----------------------------------------------------------------------------- | ||
const parserSucceed = <S, A>(value: A): DocTreeParser<S, A> => (stream) => | ||
Option.some([value, stream] as const) | ||
const parserSucceed = <S, A>(value: A): DocTreeParser<S, A> => (stream) => Option.some([value, stream] as const) | ||
const parserMap = | ||
<S, A, B>(self: DocTreeParser<S, A>, f: (a: A) => B): DocTreeParser<S, B> => (stream) => | ||
Option.map(self(stream), ([a, s]) => [f(a), s] as const) | ||
const parserMap = <S, A, B>(self: DocTreeParser<S, A>, f: (a: A) => B): DocTreeParser<S, B> => (stream) => | ||
Option.map(self(stream), ([a, s]) => [f(a), s] as const) | ||
const parserFlatMap = | ||
<S, A, B>(self: DocTreeParser<S, A>, f: (a: A) => DocTreeParser<S, B>): DocTreeParser<S, B> => | ||
(stream) => Option.flatMap(self(stream), ([a, s1]) => f(a)(s1)) | ||
<S, A, B>(self: DocTreeParser<S, A>, f: (a: A) => DocTreeParser<S, B>): DocTreeParser<S, B> => (stream) => | ||
Option.flatMap(self(stream), ([a, s1]) => f(a)(s1)) | ||
@@ -401,0 +392,0 @@ function many<S, A>(parser: DocTreeParser<S, A>): DocTreeParser<S, ReadonlyArray<A>> { |
@@ -18,4 +18,3 @@ import * as Equal from "effect/Equal" | ||
const protoHash = { | ||
Flattened: (self: Flatten.Flattened<any>) => | ||
Hash.combine(Hash.hash(self.value))(Hash.string(FlattenSymbolKey)), | ||
Flattened: (self: Flatten.Flattened<any>) => Hash.combine(Hash.hash(self.value))(Hash.string(FlattenSymbolKey)), | ||
AlreadyFlat: (_: Flatten.AlreadyFlat<any>) => | ||
@@ -32,6 +31,4 @@ Hash.combine(Hash.string("@effect/printer/Flattened/AlreadyFlat"))( | ||
isFlatten(that) && that._tag === "Flattened" && Equal.equals(self.value, that.value), | ||
AlreadyFlat: (_: Flatten.AlreadyFlat<any>, that: unknown) => | ||
isFlatten(that) && that._tag === "AlreadyFlat", | ||
NeverFlat: (_: Flatten.AlreadyFlat<any>, that: unknown) => | ||
isFlatten(that) && that._tag === "NeverFlat" | ||
AlreadyFlat: (_: Flatten.AlreadyFlat<any>, that: unknown) => isFlatten(that) && that._tag === "AlreadyFlat", | ||
NeverFlat: (_: Flatten.AlreadyFlat<any>, that: unknown) => isFlatten(that) && that._tag === "NeverFlat" | ||
} | ||
@@ -58,4 +55,3 @@ | ||
/** @internal */ | ||
export const isFlattened = <A>(self: Flatten.Flatten<A>): self is Flatten.Flattened<A> => | ||
self._tag === "Flattened" | ||
export const isFlattened = <A>(self: Flatten.Flatten<A>): self is Flatten.Flattened<A> => self._tag === "Flattened" | ||
@@ -67,4 +63,3 @@ /** @internal */ | ||
/** @internal */ | ||
export const isNeverFlat = <A>(a: Flatten.Flatten<A>): a is Flatten.NeverFlat<A> => | ||
a._tag === "NeverFlat" | ||
export const isNeverFlat = <A>(a: Flatten.Flatten<A>): a is Flatten.NeverFlat<A> => a._tag === "NeverFlat" | ||
@@ -71,0 +66,0 @@ // ----------------------------------------------------------------------------- |
@@ -36,4 +36,3 @@ import * as Effect from "effect/Effect" | ||
3, | ||
(self, fits, options) => | ||
Effect.runSync(wadlerLeijenSafe(0, 0, pipeline.cons(0, self, pipeline.nil), fits, options)) | ||
(self, fits, options) => Effect.runSync(wadlerLeijenSafe(0, 0, pipeline.cons(0, self, pipeline.nil), fits, options)) | ||
) | ||
@@ -173,4 +172,3 @@ | ||
/** @internal */ | ||
export const compact = <A>(self: Doc.Doc<A>): DocStream.DocStream<A> => | ||
Effect.runSync(compactSafe(List.of(self), 0)) | ||
export const compact = <A>(self: Doc.Doc<A>): DocStream.DocStream<A> => Effect.runSync(compactSafe(List.of(self), 0)) | ||
@@ -177,0 +175,0 @@ const compactSafe = <A>( |
@@ -113,5 +113,3 @@ import * as Effect from "effect/Effect" | ||
const doc = self.doc | ||
return Effect.suspend(() => | ||
optimizeSafe(_doc.nest(doc.doc, self.indent + doc.indent), depth) | ||
) | ||
return Effect.suspend(() => optimizeSafe(_doc.nest(doc.doc, self.indent + doc.indent), depth)) | ||
} | ||
@@ -118,0 +116,0 @@ if (self.indent === 0) { |
@@ -38,4 +38,3 @@ import * as Equal from "effect/Equal" | ||
self.ribbonFraction === that.ribbonFraction, | ||
Unbounded: (self: PageWidth.Unbounded, that: unknown) => | ||
isPageWidth(that) && that._tag === "Unbounded" | ||
Unbounded: (self: PageWidth.Unbounded, that: unknown) => isPageWidth(that) && that._tag === "Unbounded" | ||
} | ||
@@ -66,4 +65,3 @@ | ||
/** @internal */ | ||
export const isUnbounded = (self: PageWidth.PageWidth): self is PageWidth.Unbounded => | ||
self._tag === "AvailablePerLine" | ||
export const isUnbounded = (self: PageWidth.PageWidth): self is PageWidth.Unbounded => self._tag === "AvailablePerLine" | ||
@@ -70,0 +68,0 @@ // ----------------------------------------------------------------------------- |
@@ -67,4 +67,3 @@ import * as Effect from "effect/Effect" | ||
/** @internal */ | ||
export const prettyDefault = <A>(self: Doc.Doc<A>): string => | ||
render(layout.pretty(self, layout.defaultOptions)) | ||
export const prettyDefault = <A>(self: Doc.Doc<A>): string => render(layout.pretty(self, layout.defaultOptions)) | ||
@@ -86,4 +85,3 @@ /** @internal */ | ||
/** @internal */ | ||
export const smartDefault = <A>(self: Doc.Doc<A>): string => | ||
render(layout.smart(self, layout.defaultOptions)) | ||
export const smartDefault = <A>(self: Doc.Doc<A>): string => render(layout.smart(self, layout.defaultOptions)) | ||
@@ -90,0 +88,0 @@ /** @internal */ |
@@ -99,4 +99,3 @@ /** | ||
*/ | ||
export const isAvailablePerLine: (self: PageWidth) => self is AvailablePerLine = | ||
internal.isAvailablePerLine | ||
export const isAvailablePerLine: (self: PageWidth) => self is AvailablePerLine = internal.isAvailablePerLine | ||
@@ -120,4 +119,3 @@ /** | ||
*/ | ||
export const availablePerLine: (lineWidth: number, ribbonFraction: number) => PageWidth = | ||
internal.availablePerLine | ||
export const availablePerLine: (lineWidth: number, ribbonFraction: number) => PageWidth = internal.availablePerLine | ||
@@ -124,0 +122,0 @@ /** |
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
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
926080
19495
2
201