string-variants-0.1.0.1: Constrained text newtypes
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.StringVariants.NullableNonEmptyText

Synopsis

Documentation

newtype NullableNonEmptyText n Source #

Newtype wrapper around Maybe NonEmptyText that converts empty string to Nothing.

This is aimed primarily at JSON parsing: make it possible to parse empty string and turn it into Nothing, in order to convert everything into Maybe NonEmptyText at the edge of the system.

While using this for JSON parsing, use Maybe NullableNonEmptyText. Aeson special-cases Maybe to allow nulls, so Maybe catches the nulls and NullableNonEmptyText catches the empty strings.

To extract Maybe NonEmptyText values from Maybe NullableNonEmptyText, use nullableNonEmptyTextToMaybeNonEmptyText.

Instances

Instances details
KnownNat n => FromJSON (NullableNonEmptyText n) Source # 
Instance details

Defined in Data.StringVariants.NullableNonEmptyText

ToJSON (NullableNonEmptyText n) Source # 
Instance details

Defined in Data.StringVariants.NullableNonEmptyText

Generic (NullableNonEmptyText n) Source # 
Instance details

Defined in Data.StringVariants.NullableNonEmptyText

Associated Types

type Rep (NullableNonEmptyText n) :: Type -> Type #

Read (NullableNonEmptyText n) Source # 
Instance details

Defined in Data.StringVariants.NullableNonEmptyText

Show (NullableNonEmptyText n) Source # 
Instance details

Defined in Data.StringVariants.NullableNonEmptyText

Eq (NullableNonEmptyText n) Source # 
Instance details

Defined in Data.StringVariants.NullableNonEmptyText

Lift (NullableNonEmptyText n :: TYPE LiftedRep) Source # 
Instance details

Defined in Data.StringVariants.NullableNonEmptyText

Methods

lift :: Quote m => NullableNonEmptyText n -> m Exp #

liftTyped :: forall (m :: Type -> Type). Quote m => NullableNonEmptyText n -> Code m (NullableNonEmptyText n) #

type Rep (NullableNonEmptyText n) Source # 
Instance details

Defined in Data.StringVariants.NullableNonEmptyText

type Rep (NullableNonEmptyText n) = D1 ('MetaData "NullableNonEmptyText" "Data.StringVariants.NullableNonEmptyText" "string-variants-0.1.0.1-FzKJzNbSMeN1B3zsrHPi9w" 'True) (C1 ('MetaCons "NullableNonEmptyText" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (NonEmptyText n)))))

Constructing

Conversion

Functions