HORIZON HASKELLDocslts/ghc-9.14.x99ffbb82026-10-19Search packagesCtrl K
Theme: |

GHC 9.14.1 · lts/ghc-9.14.x · 99ffbb8 · 2026-10-19

Modulecases-0.1.4.5Haskell2010

Cases

Convert arbitrary text into spinal, snake, camel, and custom case formats.

The parser is tolerant to mixed delimiters and punctuation, and it can split words out of mixed-case identifiers like myHTMLProcessor.

Contents
  1. Processor
  2. Case Transformers
  3. Delimiters
  4. Default Processors
Synopsis
  • Packagecases-0.1.4.5
  • Exports13
  • LanguageHaskell2010
  • LicenceMIT
  • SourceCases.hs

Processor

Extract separate words from an arbitrary text using a smart parser and produce a new text using case transformation and delimiter functions.

Note: to skip case transformation use the id function.

Examples:

process lower spinal "abcDEF" == "abc-def"
process id camel "parse DBM XML" == "parseDbmXml"
process title whitespace "abc_def" == "Abc Def"

Case Transformers

Delimiters

newtypenewtype Delimiter

Strategy for joining parsed parts into the output text.

A delimiter controls where separators are inserted (for example -, _, whitespace, or camel-style concatenation).

Join parts with -.

Useful with lower to produce spinal case:

process lower spinal "myHTMLProcessor" == "my-html-processor"
valuesnake :: Delimiter

Join parts with _.

Useful with lower to produce snake case:

process lower snake "myHTMLProcessor" == "my_html_processor"
valuecamel :: Delimiter

Concatenate parts and title-case every part after the first one.

process id camel "parse DBM XML" == "parseDbmXml"

Default Processors

valuespinalize :: Text -> Text

Transform an arbitrary text into a lower spinal case.

Same as (process lower spinal).

spinalize "myHTMLProcessor" == "my-html-processor"
spinalize " abc_-:,/def " == "abc-def"
valuecamelize :: Text -> Text

Transform an arbitrary text into a camel case, while preserving the case of the first character.

Same as (process id camel).

camelize "abc-def" == "abcDef"
camelize "Abc-def" == AbcDef
camelize "parse DBM XML" == "parseDbmXml"