https://github.com/acatton/haskell-non-empty-text
Non Empty Text for Haskell
https://github.com/acatton/haskell-non-empty-text
Last synced: 6 months ago
JSON representation
Non Empty Text for Haskell
- Host: GitHub
- URL: https://github.com/acatton/haskell-non-empty-text
- Owner: acatton
- License: wtfpl
- Created: 2018-02-15T23:58:16.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-02-23T22:32:52.000Z (over 4 years ago)
- Last Synced: 2025-04-10T00:56:17.162Z (over 1 year ago)
- Language: Haskell
- Size: 12.7 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
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.Text` ↔ `Data.NonEmptyText` back and forth conversion.
* Basic functions: `(un)cons`, `head`, `tail`, `last`, `length`
* Text equivalent of `null` -> `isSingleton`.
### To do
* `Item` class instance
* Transformations (most importantly `map`, `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 . . toText`, but this forces
the programmer to handle the `Nothing` case, which is for many of these functions
unnecessary._
FAQ
---
### Why not text1?
[`text1`](https://hackage.haskell.org/package/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](https://hackage.haskell.org/package/papa).
`non-empty-text` is aiming towards a minimal, thin wrapper. The goal is to do
the same thing as the [`text`](https://hackage.haskell.org/package/text), with
only `text` and `base` as dependencies, no extension.