(types: ReadonlyArray<string>)
| 3 | import { pipe } from "effect/Function" |
| 4 | |
| 5 | const prettyTypes = (types: ReadonlyArray<string>): Doc.Doc<never> => { |
| 6 | const symbolDocuments = pipe( |
| 7 | Array.makeBy(types.length - 1, () => Doc.text("->")), |
| 8 | Array.prepend(Doc.text("::")) |
| 9 | ) |
| 10 | const typeDocuments = types.map(Doc.text) |
| 11 | const documents = Array.zipWith( |
| 12 | symbolDocuments, |
| 13 | typeDocuments, |
| 14 | (left, right) => Doc.catWithSpace(left, right) |
| 15 | ) |
| 16 | return Doc.align(Doc.seps(documents)) |
| 17 | } |
| 18 | |
| 19 | const prettyDeclaration = (name: string, types: ReadonlyArray<string>): Doc.Doc<never> => |
| 20 | Doc.catWithSpace(Doc.text(name), prettyTypes(types)) |
no test coverage detected