Skip to content

flipstone/haskell-non-empty-text

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Non Empty Text

Typesafe thin wrapper around Data.Text to make impossible to be empty (to always hold at least on character)

Roadmap

Done

  • Typesafe wrapper around Text
  • Data.TextData.NonEmptyText back and forth conversion.
  • Basic functions: (un)cons, head, tail, last, length
  • Text equivalent of null -> isSingleton.

To do

  • Item class instance
  • Transformations (intercalate, reverse)
  • Case conversions
  • Justification
  • Folds (especially, total fold1 functions)
  • Scans
  • Substrings

For now all of this can be done by calling toText, however the Text type doesn't ensure that all of this functions return NonEmptyText.

Another solution is to use fromText . <function> . toText, but this forces the programmer to handle the Nothing case, which is for many of these functions unnecessary.

FAQ

Why not text1?

text1 basically does the same thing than this package, and even more. It's also a great package.

However text1 has a lot of dependencies, and use an alternative homebrewed prelude.

non-empty-text is aiming towards a minimal, thin wrapper. The goal is to do the same thing as the text, with only text and base as dependencies, no extension.

About

A NonEmpty Text Type

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Haskell 75.6%
  • Shell 24.4%