gongju-text: Structured text utilities, non-empty text collections, and layout parsing

[ library, parsing, text, utilities ] [ Propose Tags ] [ Report a vulnerability ]

Gongju-Text provides robust text processing utilities leveraging non-empty refinements, polymorphic container targets, and layout-aware block/stanza parsing.


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0
Change log CHANGELOG.md
Dependencies base (>=4.18 && <5), containers (>=0.6 && <1), mono-traversable (>=1 && <2), text (>=2 && <3), vector (>=0.12 && <1) [details]
Tested with ghc ==9.6.7, ghc ==9.8.4, ghc ==9.10.3, ghc ==9.12.4, ghc ==9.14.1
License (EUPL-1.2 OR Apache-2.0)
Author Nadia Yvette Chambers
Maintainer nadia.yvette.chambers@ik.me
Uploaded by nyc at 2026-11-03T19:38:34Z
Category Text, Parsing, Utilities
Home page https://github.com/NadiaYvette/gongju
Bug tracker https://github.com/NadiaYvette/gongju/issues
Source repo head: git clone https://github.com/NadiaYvette/gongju.git(packages/gongju-text)
Distributions
Downloads 3 total (3 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]

Readme for gongju-text-0.1.0.0

[back to package description]

gongju-text

Structured text utilities, non-empty text collections, and layout parsing for Haskell.

gongju-text provides lightweight, robust text processing utilities leveraging non-empty refinements, polymorphic container targets, and layout-aware block and stanza parsing.


Features

  1. Non-Empty Text Refinements (Gongju.Text.NonEmpty):

    • Safe construction and unwrap via NonNull Text (fromText, toText).
    • Non-empty word splitting (wordsNE :: Text -> Maybe (NonEmpty Text)).
    • Non-empty line splitting (linesNE :: Text -> Maybe (NonEmpty Text)).
  2. Polymorphic Stanza Chunking (Gongju.Text.Stanza):

    • Stanza grouping of lines separated by one or more blank or whitespace lines.
    • Container-polymorphic wrapper Stanza container.
    • List-based (stanzas :: Text -> [Stanza []]) and sequence-based (stanzasSeq :: Text -> Seq (Stanza Seq)) chunking.
  3. Indentation and Block Parsing (Gongju.Text.Layout):

    • Space-indentation measuring (parseIndentedLines :: [Text] -> [IndentedLine]).
    • Hierarchical indentation block tree construction (parseBlocks :: [Text] -> [Block]).
    • Zero-dependency layout analysis without full Markdown or YAML parser overhead.

Quick Example

{-# LANGUAGE OverloadedStrings #-}

import qualified Data.Text as T
import Gongju.Text.NonEmpty (wordsNE)
import Gongju.Text.Stanza (stanzas, unStanza)
import Gongju.Text.Layout (parseBlocks, Block(..))

main :: IO ()
main = do
  -- 1. Non-empty word splitting
  print (wordsNE "hello   world")

  -- 2. Stanza grouping
  let doc = "First stanza line 1\nLine 2\n\nSecond stanza line 1\nLine 2"
  mapM_ (print . unStanza) (stanzas doc)

  -- 3. Indented block hierarchy
  let lines' = ["root", "  child 1", "  child 2", "    grandchild"]
  print (parseBlocks lines')

License

Licensed under the European Union Public Licence (EUPL-1.2) or Apache License 2.0.