[{"name":"Pretty","comment":" A Wadler/Leijen-style pretty printer. Build documents with combinators,\nthen render them to fit a page width.\n\n@docs Doc\n\n\n# Rendering\n\n@docs pretty, prettyWithRibbon\n\n\n# Primitives\n\n@docs empty, space, string, taggedString, char\n\n\n# Combining Documents\n\n@docs append, a, join, lines, separators, softlines, words, fold\n\n\n# Layout Control\n\n@docs group, line, tightline, softline, flatAlt, ifFlat, ifBreak\n\n\n# Indentation\n\n@docs align, nest, hang, indent\n\n\n# Delimiters\n\n@docs surround, parens, braces, brackets\n\n\n# Tagging\n\n@docs setTag, updateTag\n\n","unions":[],"aliases":[{"name":"Doc","comment":" A document represents possible layouts. The `t` parameter allows tagging\nstrings for syntax highlighting (see `Pretty.Renderer`).\n\n    doc = group (string \"hello\" |> a line |> a (string \"world\"))\n\n    pretty 20 doc  -- \"hello world\"\n    pretty 5 doc   -- \"hello\\nworld\"\n\n","args":["t"],"type":"Internals.Doc t"}],"values":[{"name":"a","comment":" Flip of `append` for use in pipelines. Read as \"and\":\n\n    string \"if\"\n        |> a space\n        |> a (string \"x > 0\")\n        |> a space\n        |> a (string \"then\")\n    -- \"if x > 0 then\"\n\n","type":"Pretty.Doc t -> Pretty.Doc t -> Pretty.Doc t"},{"name":"align","comment":" Aligns subsequent lines to the current column position. Unlike `nest` which\nadds a fixed indent, `align` indents relative to where you are now.\n\n    string \"let \" |> a (align (lines [ string \"x = 1\", string \"y = 2\" ]))\n    -- \"let x = 1\\n    y = 2\"\n    --     ^--- aligned to column 4 (after \"let \")\n\nUseful for hanging indentation that adapts to context.\n\n","type":"Pretty.Doc t -> Pretty.Doc t"},{"name":"append","comment":" Concatenates two documents. The first argument comes before the second.\n\n    append (string \"hello\") (string \"world\") -- \"helloworld\"\n\nUsually it's more convenient to use `a` for pipelines, or `join`/`words`/`lines`\nfor lists.\n\n","type":"Pretty.Doc t -> Pretty.Doc t -> Pretty.Doc t"},{"name":"braces","comment":" Wraps a document in curly braces.\n\n    braces (string \"x: 1\")  -- \"{x: 1}\"\n\n","type":"Pretty.Doc t -> Pretty.Doc t"},{"name":"brackets","comment":" Wraps a document in square brackets.\n\n    brackets (string \"1, 2, 3\")  -- \"[1, 2, 3]\"\n\n","type":"Pretty.Doc t -> Pretty.Doc t"},{"name":"char","comment":" Creates a document from a single character.\n\n    char '(' |> a (string \"x\") |> a (char ')')  -- \"(x)\"\n\n","type":"Char.Char -> Pretty.Doc t"},{"name":"empty","comment":" An empty document that produces no output.\n\nUnlike `string \"\"`, empties are filtered out by `join`, `lines`, `words`, etc.\nThis prevents double separators when some items are conditionally absent:\n\n    words [ string \"a\", empty, string \"b\" ] -- \"a b\", not \"a  b\"\n\n    -- Conditional content:\n    words [ string \"hello\", if showName then string name else empty ]\n\n","type":"Pretty.Doc t"},{"name":"flatAlt","comment":" Choose between two documents based on flat vs broken mode.\n\n    group (flatAlt (string \"flat\") (string \"broken\"))\n    -- Wide: \"flat\"  |  Narrow: \"broken\"\n\nWithout a surrounding `group`, always uses the broken (second) argument.\n\nUnlike `line`/`tightline` which vary a single token, `flatAlt` allows entirely\ndifferent document structures in each mode:\n\n    -- Different paren spacing: \"(x)\" when flat, \"( x\\n)\" when broken\n    group (flatAlt\n        (char '(' |> a x |> a (char ')'))\n        (string \"( \" |> a x |> a line |> a (char ')'))\n    )\n\n","type":"Pretty.Doc t -> Pretty.Doc t -> Pretty.Doc t"},{"name":"fold","comment":" Left fold over a list, starting from `empty`.\n\n    fold (\\item acc -> acc |> a (string item)) [ \"a\", \"b\", \"c\" ]\n    -- \"abc\"\n\n","type":"(a -> Pretty.Doc t -> Pretty.Doc t) -> List.List a -> Pretty.Doc t"},{"name":"group","comment":" Try to lay out a document on one line; if it doesn't fit, break it.\n\nThis is the key combinator for flexible layouts. It creates a choice between\nthe flattened version (line breaks become spaces) and the original.\n\n    items = string \"one\" |> a line |> a (string \"two\") |> a line |> a (string \"three\")\n\n    pretty 20 (group items) == \"one two three\"  -- fits\n    pretty 10 (group items) == \"one\\ntwo\\nthree\" -- doesn't fit, breaks\n\nNested groups break outside-in: the outer group breaks first, inner groups\nmay still fit on their lines.\n\n","type":"Pretty.Doc t -> Pretty.Doc t"},{"name":"hang","comment":" Combines `align` with additional nesting. Equivalent to `align (nest n doc)`.\n\n    string \"fn(\" |> a (hang 2 (lines [ string \"arg1\", string \"arg2\" ])) |> a (string \")\")\n    -- \"fn(arg1\\n     arg2)\"\n    --    ^--- aligned to column 3, plus 2 more = column 5\n\n","type":"Basics.Int -> Pretty.Doc t -> Pretty.Doc t"},{"name":"ifBreak","comment":" Includes a document only when broken; becomes empty in flat mode.\n\n    -- Trailing comma only in multi-line mode\n    group (lines [ string \"a\" |> a (ifBreak (char ',')), string \"b\" ])\n    -- Wide: \"a b\"\n    -- Narrow: \"a,\\nb\"\n\nEquivalent to `flatAlt empty doc`.\n\n","type":"Pretty.Doc t -> Pretty.Doc t"},{"name":"ifFlat","comment":" Includes a document only in flat mode; becomes empty when broken.\n\n    group (string \"items\" |> a (ifFlat (string \" (inline)\")))\n    -- Wide: \"items (inline)\"\n    -- Narrow: \"items\"\n\nEquivalent to `flatAlt doc empty`.\n\n","type":"Pretty.Doc t -> Pretty.Doc t"},{"name":"indent","comment":" Indents the first line AND all subsequent lines by the given amount.\n\n    indent 4 (lines [ string \"one\", string \"two\" ])\n    -- \"    one\\n    two\"\n\nCompare with `nest` which only affects lines after breaks, not the first line.\n\n","type":"Basics.Int -> Pretty.Doc t -> Pretty.Doc t"},{"name":"join","comment":" Joins documents with a separator between each pair. Empty documents are\nfiltered out to prevent double separators.\n\n    join (string \", \") [ string \"a\", string \"b\", string \"c\" ]  -- \"a, b, c\"\n\n    join (string \", \") [ string \"a\", empty, string \"c\" ]  -- \"a, c\" (not \"a, , c\")\n\nSee also `words` (join with space), `lines` (join with line), `separators`.\n\n","type":"Pretty.Doc t -> List.List (Pretty.Doc t) -> Pretty.Doc t"},{"name":"line","comment":" A line break that becomes a space when flattened by `group`.\n\n    -- Without group: always breaks\n    string \"a\" |> a line |> a (string \"b\")  -- \"a\\nb\"\n\n    -- With group: breaks only if needed\n    group (string \"a\" |> a line |> a (string \"b\"))\n    -- Wide: \"a b\"    (line becomes space)\n    -- Narrow: \"a\\nb\" (line breaks)\n\nUse `tightline` if you want no space when flattened.\n\n","type":"Pretty.Doc t"},{"name":"lines","comment":" Joins documents with `line` between each. Equivalent to `join line`.\n\n    lines [ string \"one\", string \"two\", string \"three\" ]\n    -- \"one\\ntwo\\nthree\"\n\nWrap in `group` for flexible breaking:\n\n    group (lines [ string \"a\", string \"b\" ])\n    -- Wide: \"a b\"  |  Narrow: \"a\\nb\"\n\n","type":"List.List (Pretty.Doc t) -> Pretty.Doc t"},{"name":"nest","comment":" Adds indentation to all line breaks inside a document. The first line is\nNOT indented—only lines after breaks.\n\n    string \"{\" |> a (nest 4 (line |> a (string \"body\"))) |> a line |> a (string \"}\")\n    -- \"{\\n    body\\n}\"\n\nCommon mistake—nest around content without a line break inside:\n\n    nest 4 (string \"no effect\")  -- just \"no effect\", no indentation\n\nThe line break must be INSIDE the nest for indentation to apply.\n\n","type":"Basics.Int -> Pretty.Doc t -> Pretty.Doc t"},{"name":"parens","comment":" Wraps a document in parentheses.\n\n    parens (string \"x + y\")  -- \"(x + y)\"\n\n","type":"Pretty.Doc t -> Pretty.Doc t"},{"name":"pretty","comment":" Renders a document to a string, fitting it within the given column width.\n\nThe algorithm makes greedy left-to-right decisions: when a `group` fits on the\nremaining line, it stays flat; otherwise it breaks.\n\n    doc = group (string \"aaa\" |> a line |> a (string \"bbb\"))\n\n    pretty 10 doc == \"aaa bbb\"   -- fits in 10 columns\n    pretty 5 doc  == \"aaa\\nbbb\"  -- too wide, breaks\n\n","type":"Basics.Int -> Pretty.Doc t -> String.String"},{"name":"prettyWithRibbon","comment":" Renders a document with both page width and ribbon width constraints.\n\nThe ribbon width limits non-indentation characters per line. At indentation\nlevel `i`, the effective width is `min(pageWidth, i + ribbonWidth)`.\n\n    prettyWithRibbon { pageWidth = 80, ribbonWidth = 40 } doc\n\nThis keeps deeply nested code compact. At indent 50 with ribbon 40, lines\nbreak at column 80 (not 90), preventing rightward drift.\n\nIf `ribbonWidth >= pageWidth`, behaves identically to `pretty pageWidth`.\n\n","type":"{ pageWidth : Basics.Int, ribbonWidth : Basics.Int } -> Pretty.Doc t -> String.String"},{"name":"separators","comment":" Joins documents with a separator that appears both when flat and when broken.\nUseful for leading-comma or leading-pipe style:\n\n    separators \", \" [ string \"a\", string \"b\", string \"c\" ] |> group\n    -- Wide:   \"a, b, c\"\n    -- Narrow: \"a\\n, b\\n, c\"\n\n    separators \"| \" [ string \"A\", string \"B\" ] |> group\n    -- Wide:   \"A| B\"\n    -- Narrow: \"A\\n| B\"\n\n","type":"String.String -> List.List (Pretty.Doc t) -> Pretty.Doc t"},{"name":"setTag","comment":" Tags all strings in a document for syntax highlighting.\n\n    type Tag = Error\n\n    setTag Error (words [ string \"undefined\", string \"variable\" ])\n    -- Both strings will be tagged as Error\n\n","type":"t -> Pretty.Doc t -> Pretty.Doc t"},{"name":"softline","comment":" A line break that tries to be a space. Equivalent to `group line`.\n\nUnlike `line` inside a `group`, each `softline` makes its own independent\nbreak decision:\n\n    string \"a\" |> a softline |> a (string \"b\") |> a softline |> a (string \"c\")\n    -- Might render as: \"a b\\nc\" if \"a b\" fits but \"a b c\" doesn't\n\n","type":"Pretty.Doc t"},{"name":"softlines","comment":" Joins documents with `softline` (each break decides independently).\n\n    softlines [ string \"one\", string \"two\", string \"three\" ]\n    -- Each softline independently becomes space or newline based on fit\n\nUnlike `group (lines [...])` where all breaks happen together, here each\nbreak point makes its own decision.\n\n","type":"List.List (Pretty.Doc t) -> Pretty.Doc t"},{"name":"space","comment":" A single space character. Equivalent to `char ' '`.\n\n    string \"hello\" |> a space |> a (string \"world\")  -- \"hello world\"\n\n","type":"Pretty.Doc t"},{"name":"string","comment":" Creates a document from a string. This is the primary way to add text content.\n\n    pretty 80 (string \"hello\") == \"hello\"\n\n    string \"let\" |> a space |> a (string \"x = 1\")  -- \"let x = 1\"\n\n","type":"String.String -> Pretty.Doc t"},{"name":"surround","comment":" Wraps a document with left and right delimiters.\n\n    surround (string \"<<\") (string \">>\") (string \"content\")  -- \"<<content>>\"\n\nSee also `parens`, `braces`, `brackets` for common cases.\n\n","type":"Pretty.Doc t -> Pretty.Doc t -> Pretty.Doc t -> Pretty.Doc t"},{"name":"taggedString","comment":" Creates a tagged string for syntax highlighting. Use with `Pretty.Renderer`\nto produce HTML or other formatted output.\n\n    type Tag = Keyword | Literal\n\n    taggedString \"let\" Keyword |> a space |> a (taggedString \"42\" Literal)\n\n","type":"String.String -> t -> Pretty.Doc t"},{"name":"tightline","comment":" A line break that becomes nothing when flattened by `group`.\n\nUse this before closing delimiters to avoid unwanted spaces:\n\n    -- Array formatting\n    group (\n        char '[' |> a tightline\n            |> a (string \"items\")\n            |> a tightline |> a (char ']')\n    )\n    -- Wide:   \"[items]\"  (no spaces)\n    -- Narrow: \"[\\nitems\\n]\"\n\nCompare with `line` which would produce \"[ items ]\" when flat.\n\n","type":"Pretty.Doc t"},{"name":"updateTag","comment":" Conditionally update tags based on string content and current tag.\n\n    -- Tag numbers as literals\n    updateTag (\\s _ ->\n        if String.all Char.isDigit s then Just Literal else Nothing\n    ) doc\n\n    -- Remove all tags\n    updateTag (\\_ _ -> Nothing) doc\n\n","type":"(String.String -> Maybe.Maybe t -> Maybe.Maybe t) -> Pretty.Doc t -> Pretty.Doc t"},{"name":"words","comment":" Joins documents with spaces. Equivalent to `join space`.\n\n    words [ string \"hello\", string \"world\" ]  -- \"hello world\"\n\nEmpty docs are filtered out, preventing double spaces.\n\n","type":"List.List (Pretty.Doc t) -> Pretty.Doc t"}],"binops":[]},{"name":"Pretty.Renderer","comment":" Custom rendering for syntax highlighting or structured output.\n\nUse `Pretty.pretty` for plain text. Use this module to:\n\n  - Render to HTML with syntax highlighting\n  - Handle tagged strings differently based on their tags\n  - Produce any accumulator-based output format\n\n@docs Renderer, pretty, prettyWithRibbon\n\n","unions":[],"aliases":[{"name":"Renderer","comment":" Accumulator-based renderer, similar to `foldl`.\n\n  - `init`: Starting accumulator value\n  - `tagged`: Handle tagged text (for syntax highlighting)\n  - `untagged`: Handle untagged text and indentation\n  - `newline`: Handle line breaks (add `\\n` here if needed)\n  - `outer`: Transform final accumulator to output type\n\nText is processed left-to-right; reverse lists if accumulating in order.\n\n    htmlRenderer : Renderer Tag (List (Html msg)) (Html msg)\n    htmlRenderer =\n        { init = []\n        , tagged = \\tag text acc -> styledSpan tag text :: acc\n        , untagged = \\text acc -> Html.text text :: acc\n        , newline = \\acc -> Html.br [] [] :: acc\n        , outer = \\acc -> Html.pre [] (List.reverse acc)\n        }\n\n","args":["t","a","b"],"type":"{ init : a, tagged : t -> String.String -> a -> a, untagged : String.String -> a -> a, newline : a -> a, outer : a -> b }"}],"values":[{"name":"pretty","comment":" Renders a document using a custom `Renderer`.\n\n    pretty 80 htmlRenderer doc\n\n","type":"Basics.Int -> Pretty.Renderer.Renderer t a b -> Internals.Doc t -> b"},{"name":"prettyWithRibbon","comment":" Pretty prints with both page width and ribbon width constraints.\n\nThe ribbon width limits non-indentation characters per line. At indentation\nlevel `i`, the effective width is `min(pageWidth, i + ribbonWidth)`.\n\n","type":"{ pageWidth : Basics.Int, ribbonWidth : Basics.Int } -> Pretty.Renderer.Renderer t a b -> Internals.Doc t -> b"}],"binops":[]}]