| Copyright | (c) Viktor Dukhovni 2026 |
|---|---|
| License | BSD-3-Clause |
| Maintainer | ietf-dane@dukhovni.org |
| Stability | unstable |
| Safe Haskell | None |
| Language | GHC2024 |
Net.DNSBase.NonEmpty
Description
The NonEmpty type from Data.List.NonEmpty plus a typeclass
IsNonEmptyList modelled on IsList: types like
SPV_mandatory that hold a non-empty
collection can derive a conversion through this class without
having to provide the [a]-typed IsList interface
that would tempt callers into supplying empty lists.
Synopsis
- class IsNonEmptyList a where
- type Item1 a
- toNonEmptyList :: a -> NonEmpty (Item1 a)
- fromNonEmptyList :: NonEmpty (Item1 a) -> a
- data NonEmpty a = a :| [a]
Documentation
class IsNonEmptyList a where Source #
Structures that can be converted to non-empty lists. Note that
toNonEmptyList and fromNonEmptyList aren't necessarily inverses.
The result may, for example, be reordered or deduplicated.
Methods
toNonEmptyList :: a -> NonEmpty (Item1 a) Source #
fromNonEmptyList :: NonEmpty (Item1 a) -> a Source #
Instances
| IsNonEmptyList NxtTypes Source # | |||||
| IsNonEmptyList SPV_mandatory Source # | |||||
Defined in Net.DNSBase.RData.SVCB.SPV Associated Types
Methods toNonEmptyList :: SPV_mandatory -> NonEmpty (Item1 SPV_mandatory) Source # fromNonEmptyList :: NonEmpty (Item1 SPV_mandatory) -> SPV_mandatory Source # | |||||
| IsNonEmptyList (NonEmpty a) Source # | |||||
Defined in Net.DNSBase.NonEmpty Associated Types
| |||||
Non-empty (and non-strict) list type.
Since: base-4.9.0.0
Constructors
| a :| [a] infixr 5 |