named-text
A parameterized named text type and associated functionality.
| LTS Haskell 24.55: | 1.2.4.0 |
| Stackage Nightly 2026-08-24: | 1.2.5.0 |
| Latest on Hackage: | 1.2.5.0 |
named-text-1.2.5.0@sha256:ded48d5c6bf3a04adf16b51836915f8294d62ec93beeb2dddb24e95f68db7ae7,3595Module documentation for 1.2.5.0
- Data
A plain String or Text is dangerous because it can be arbitrarily combined, converted, emitted, and updated without consideration of the validity and applicability of the contents and the usage scenario.
This module provides a Named type wrapper around Text which has two additional type parameters: one which indicates what the content of the Text represents, and one which indicates the style of the name.
There are additionally functions and classes which allow conversions and transformations between names with different styles and types (or disallow them where appropriate).
The core intent of this library is that the Named is used instead of a raw String or Text to provide type-level tracking and safety.
Changes
Revision history for named-text
1.2.5.0 – 2026-08-23
-
Added
NameUtilitiesclass, which defines the following methods:dropNamedropNameWhiledropNameWhileEndtakeNamebreakNamebreakOnNameisPrefixOfNameisSuffixOfNameisInfixOfNameunconsName
There are instances of the above (which function similarly to their
Data.Textequivalents) for many–but not all–Name Styles. Notably there are no instances forSecurestyle names because that would allow leakage of the secure name, nor forHTMLStyleorJSONStylenames due to the risk of corrupted results due to the structured contents of those styles. -
Updated
CaseInsensitivePreserveimplementation internally to usetoCaseFoldinstead oftoCaseLowerfor various operations. This should have no impact but may change the behavior ofEq,Ord, orHashableoperations.* -
Internal optimizations.
1.2.4.0 – 2026-07-04
-
Allow building with GHC 9.14.
-
Added Language.Haskell.TH.Syntax.Lift instance for Named, allowing it to be used in Template Haskell splices.
1.2.3.0 – 2026-03-10
- Added CaseInsensitivePreserve style, which functions similarly to CaseInsensitive style in that it performs comparisons in a case insensitive manner, but it stores and divulges the text in the original case.
1.2.2.0 – 2024-10-26
- Allow building with GHC 9.12.
1.2.1.0 – 2024-09-19
- Allow building with GHC 9.8 and 9.10.
1.2.0.0 – 2024-07-23
- Remove default Eq, Ord, and Hashable instances for all Named. An explicit or derived instance must be declared for each NamedStyle and/or nameOf variant. This is to allow a particular NamedStyle or nameOf variant to override the instance implementation of these functions. Instances are provided the UTF8, CaseInsensitive, Secure, HTMLStyle, and JSONStyle Named so any module using only those styles will be backward compatible, but any external named instances will likely need Eq, Ord, and Hashable instances provided.
- Add HTML NameStyle and conversions between HTML and UTF8 name styles.
- Add conversion from UTF8 to CaseInsensitive name styles (but not the reverse).
- Remove deprecated functions: name, caselessName, secureName
1.1.4.0 – 2023-10-01
- Update to allow Sayable 1.2.0.0
1.1.3.0 – 2023-06-20
- Allow build with GHC 9.6.
1.1.2.0 – 2023-01-17
- Updated sayable package upper bound to < 1.2.
1.1.1.0 – 2022-12-28
- Added optional Data.Name.JSON providing
JSONSchemawith AesonToJSONandFromJSONinstances. - Additional tests.
- Added README and updated nix flake.
1.1.0.0 – 2022-12-28
- Added tests and enhanced haddock.
- Re-organized implementation, removing extraneous definitions.
- The
nameandcaselessNamefunctions are deprecated in favor ofnameText. - General, overlappable
PrettyprinterPrettyinstance for allNamed. - Changed from
Named style symtoNamed style nameOf. - Fixed
convertStyleto use the properfromTextinstance. - Added
NameTextconstraint toviewSomeNameStylefirst argument signature. - Added
nameLengthandnullNameutility functions.
1.0.1.0 – 2022-12-23
- Specific GHC support range for GHC 8.8–9.4
- Small cabal file adjustments.
1.0.0.0 – 2022-06-29
- First independent version.