idn-0.1.2.0: Pure Haskell IDN and Punycode implementation
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Text.IDN.Types

Description

Core types for Internationalized Domain Names (IDN) processing.

This module provides types for domain name processing following the IDNA2008 specification (RFC 5890-5893). Types are organized into logical groups: errors, domain structures, Unicode properties, and Punycode internals.

Example

>>> mkLabel "example"
Right (ULabel "example")
>>> mkDomainName "example.com"
Right (DomainName {labels = ...})
Synopsis

Error Types

data IDNError Source #

IDN processing errors with detailed context.

Errors include validation failures, encoding issues, and constraint violations per IDNA2008 (RFC 5890-5893).

Constructors

EmptyLabel

Domain label cannot be empty

LabelTooLong 

Fields

TotalDomainTooLong 

Fields

InvalidHyphenPosition HyphenError

Hyphen appears in invalid position

StartsWithCombiningMark 

Fields

DisallowedCodePoint 

Fields

InvalidContext 

Fields

BidiViolation 

Fields

PunycodeDecodeError 

Fields

Instances

Instances details
Generic IDNError Source # 
Instance details

Defined in Data.Text.IDN.Types

Associated Types

type Rep IDNError 
Instance details

Defined in Data.Text.IDN.Types

type Rep IDNError = D1 ('MetaData "IDNError" "Data.Text.IDN.Types" "idn-0.1.2.0-ECOO1RAUys73BxjjVgDeye" 'False) (((C1 ('MetaCons "EmptyLabel" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "LabelTooLong" 'PrefixI 'True) (S1 ('MetaSel ('Just "actualLength") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int) :*: S1 ('MetaSel ('Just "maxLength") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int))) :+: (C1 ('MetaCons "TotalDomainTooLong" 'PrefixI 'True) (S1 ('MetaSel ('Just "actualLength") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int) :*: S1 ('MetaSel ('Just "maxLength") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)) :+: C1 ('MetaCons "InvalidHyphenPosition" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 HyphenError)))) :+: ((C1 ('MetaCons "StartsWithCombiningMark" 'PrefixI 'True) (S1 ('MetaSel ('Just "character") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Char) :*: S1 ('MetaSel ('Just "codepoint") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)) :+: C1 ('MetaCons "DisallowedCodePoint" 'PrefixI 'True) (S1 ('MetaSel ('Just "character") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Char) :*: S1 ('MetaSel ('Just "codepoint") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int))) :+: (C1 ('MetaCons "InvalidContext" 'PrefixI 'True) ((S1 ('MetaSel ('Just "character") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Char) :*: S1 ('MetaSel ('Just "contextRule") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ContextRule)) :*: (S1 ('MetaSel ('Just "position") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int) :*: S1 ('MetaSel ('Just "context") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text))) :+: (C1 ('MetaCons "BidiViolation" 'PrefixI 'True) (S1 ('MetaSel ('Just "bidiRule") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 BidiRule) :*: S1 ('MetaSel ('Just "label") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)) :+: C1 ('MetaCons "PunycodeDecodeError" 'PrefixI 'True) (S1 ('MetaSel ('Just "input") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "reason") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text))))))

Methods

from :: IDNError -> Rep IDNError x #

to :: Rep IDNError x -> IDNError #

Show IDNError Source # 
Instance details

Defined in Data.Text.IDN.Types

NFData IDNError Source # 
Instance details

Defined in Data.Text.IDN.Types

Methods

rnf :: IDNError -> () #

Eq IDNError Source # 
Instance details

Defined in Data.Text.IDN.Types

type Rep IDNError Source # 
Instance details

Defined in Data.Text.IDN.Types

type Rep IDNError = D1 ('MetaData "IDNError" "Data.Text.IDN.Types" "idn-0.1.2.0-ECOO1RAUys73BxjjVgDeye" 'False) (((C1 ('MetaCons "EmptyLabel" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "LabelTooLong" 'PrefixI 'True) (S1 ('MetaSel ('Just "actualLength") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int) :*: S1 ('MetaSel ('Just "maxLength") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int))) :+: (C1 ('MetaCons "TotalDomainTooLong" 'PrefixI 'True) (S1 ('MetaSel ('Just "actualLength") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int) :*: S1 ('MetaSel ('Just "maxLength") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)) :+: C1 ('MetaCons "InvalidHyphenPosition" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 HyphenError)))) :+: ((C1 ('MetaCons "StartsWithCombiningMark" 'PrefixI 'True) (S1 ('MetaSel ('Just "character") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Char) :*: S1 ('MetaSel ('Just "codepoint") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)) :+: C1 ('MetaCons "DisallowedCodePoint" 'PrefixI 'True) (S1 ('MetaSel ('Just "character") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Char) :*: S1 ('MetaSel ('Just "codepoint") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int))) :+: (C1 ('MetaCons "InvalidContext" 'PrefixI 'True) ((S1 ('MetaSel ('Just "character") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Char) :*: S1 ('MetaSel ('Just "contextRule") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ContextRule)) :*: (S1 ('MetaSel ('Just "position") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int) :*: S1 ('MetaSel ('Just "context") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text))) :+: (C1 ('MetaCons "BidiViolation" 'PrefixI 'True) (S1 ('MetaSel ('Just "bidiRule") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 BidiRule) :*: S1 ('MetaSel ('Just "label") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)) :+: C1 ('MetaCons "PunycodeDecodeError" 'PrefixI 'True) (S1 ('MetaSel ('Just "input") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "reason") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text))))))

data HyphenError Source #

Hyphen position errors.

Domain labels cannot start or end with hyphens, and hyphens at positions 3-4 are reserved for Punycode encoding.

Constructors

StartsWithHyphen

Label starts with hyphen (invalid)

EndsWithHyphen

Label ends with hyphen (invalid)

HyphensAt3And4NotPunycode

Hyphens at positions 3-4 but not a valid Punycode label

Instances

Instances details
Generic HyphenError Source # 
Instance details

Defined in Data.Text.IDN.Types

Associated Types

type Rep HyphenError 
Instance details

Defined in Data.Text.IDN.Types

type Rep HyphenError = D1 ('MetaData "HyphenError" "Data.Text.IDN.Types" "idn-0.1.2.0-ECOO1RAUys73BxjjVgDeye" 'False) (C1 ('MetaCons "StartsWithHyphen" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "EndsWithHyphen" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "HyphensAt3And4NotPunycode" 'PrefixI 'False) (U1 :: Type -> Type)))
Show HyphenError Source # 
Instance details

Defined in Data.Text.IDN.Types

NFData HyphenError Source # 
Instance details

Defined in Data.Text.IDN.Types

Methods

rnf :: HyphenError -> () #

Eq HyphenError Source # 
Instance details

Defined in Data.Text.IDN.Types

type Rep HyphenError Source # 
Instance details

Defined in Data.Text.IDN.Types

type Rep HyphenError = D1 ('MetaData "HyphenError" "Data.Text.IDN.Types" "idn-0.1.2.0-ECOO1RAUys73BxjjVgDeye" 'False) (C1 ('MetaCons "StartsWithHyphen" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "EndsWithHyphen" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "HyphensAt3And4NotPunycode" 'PrefixI 'False) (U1 :: Type -> Type)))

data PunycodeError Source #

Punycode encoding/decoding errors.

These errors occur during low-level Punycode operations. For domain-level errors, see IDNError.

Constructors

InvalidPunycode Text

Malformed Punycode string with reason

Overflow

Integer overflow during encoding/decoding

Instances

Instances details
Generic PunycodeError Source # 
Instance details

Defined in Data.Text.IDN.Types

Associated Types

type Rep PunycodeError 
Instance details

Defined in Data.Text.IDN.Types

type Rep PunycodeError = D1 ('MetaData "PunycodeError" "Data.Text.IDN.Types" "idn-0.1.2.0-ECOO1RAUys73BxjjVgDeye" 'False) (C1 ('MetaCons "InvalidPunycode" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)) :+: C1 ('MetaCons "Overflow" 'PrefixI 'False) (U1 :: Type -> Type))
Show PunycodeError Source # 
Instance details

Defined in Data.Text.IDN.Types

NFData PunycodeError Source # 
Instance details

Defined in Data.Text.IDN.Types

Methods

rnf :: PunycodeError -> () #

Eq PunycodeError Source # 
Instance details

Defined in Data.Text.IDN.Types

type Rep PunycodeError Source # 
Instance details

Defined in Data.Text.IDN.Types

type Rep PunycodeError = D1 ('MetaData "PunycodeError" "Data.Text.IDN.Types" "idn-0.1.2.0-ECOO1RAUys73BxjjVgDeye" 'False) (C1 ('MetaCons "InvalidPunycode" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)) :+: C1 ('MetaCons "Overflow" 'PrefixI 'False) (U1 :: Type -> Type))

Domain Types

data Label Source #

Domain label in either Unicode or ASCII/Punycode form.

Labels are the components of a domain name separated by dots. They can be in Unicode form (U-label) or ASCII/Punycode form (A-label).

Constructors

ULabel Text

Unicode label (U-label) - contains Unicode characters

ALabel Text

ASCII/Punycode label (A-label) - contains ASCII or Punycode with xn-- prefix

Instances

Instances details
Generic Label Source # 
Instance details

Defined in Data.Text.IDN.Types

Associated Types

type Rep Label 
Instance details

Defined in Data.Text.IDN.Types

type Rep Label = D1 ('MetaData "Label" "Data.Text.IDN.Types" "idn-0.1.2.0-ECOO1RAUys73BxjjVgDeye" 'False) (C1 ('MetaCons "ULabel" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)) :+: C1 ('MetaCons "ALabel" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))

Methods

from :: Label -> Rep Label x #

to :: Rep Label x -> Label #

Show Label Source # 
Instance details

Defined in Data.Text.IDN.Types

Methods

showsPrec :: Int -> Label -> ShowS #

show :: Label -> String #

showList :: [Label] -> ShowS #

NFData Label Source # 
Instance details

Defined in Data.Text.IDN.Types

Methods

rnf :: Label -> () #

Eq Label Source # 
Instance details

Defined in Data.Text.IDN.Types

Methods

(==) :: Label -> Label -> Bool #

(/=) :: Label -> Label -> Bool #

type Rep Label Source # 
Instance details

Defined in Data.Text.IDN.Types

type Rep Label = D1 ('MetaData "Label" "Data.Text.IDN.Types" "idn-0.1.2.0-ECOO1RAUys73BxjjVgDeye" 'False) (C1 ('MetaCons "ULabel" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)) :+: C1 ('MetaCons "ALabel" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))

newtype DomainName Source #

Complete domain name consisting of one or more labels.

A domain name is a non-empty sequence of labels separated by dots. The total length must not exceed 253 characters.

Constructors

DomainName 

Fields

Instances

Instances details
Generic DomainName Source # 
Instance details

Defined in Data.Text.IDN.Types

Associated Types

type Rep DomainName 
Instance details

Defined in Data.Text.IDN.Types

type Rep DomainName = D1 ('MetaData "DomainName" "Data.Text.IDN.Types" "idn-0.1.2.0-ECOO1RAUys73BxjjVgDeye" 'True) (C1 ('MetaCons "DomainName" 'PrefixI 'True) (S1 ('MetaSel ('Just "labels") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (NonEmpty Label))))
Show DomainName Source # 
Instance details

Defined in Data.Text.IDN.Types

NFData DomainName Source # 
Instance details

Defined in Data.Text.IDN.Types

Methods

rnf :: DomainName -> () #

Eq DomainName Source # 
Instance details

Defined in Data.Text.IDN.Types

type Rep DomainName Source # 
Instance details

Defined in Data.Text.IDN.Types

type Rep DomainName = D1 ('MetaData "DomainName" "Data.Text.IDN.Types" "idn-0.1.2.0-ECOO1RAUys73BxjjVgDeye" 'True) (C1 ('MetaCons "DomainName" 'PrefixI 'True) (S1 ('MetaSel ('Just "labels") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (NonEmpty Label))))

mkLabel :: Text -> Either IDNError Label Source #

Smart constructor for Label with invariant enforcement.

Validates that the label is non-empty and within length constraints. Automatically detects A-labels (those starting with "xn--").

Examples

>>> mkLabel "example"
Right (ULabel "example")
>>> mkLabel "xn--mnchen-3ya"
Right (ALabel "xn--mnchen-3ya")
>>> mkLabel ""
Left EmptyLabel

mkDomainName :: Text -> Either IDNError DomainName Source #

Smart constructor for DomainName with invariant enforcement.

Validates that the domain is non-empty, within length constraints, and properly formatted. Splits on dots to create individual labels.

Examples

>>> mkDomainName "example.com"
Right (DomainName {labels = ...})
>>> mkDomainName ""
Left EmptyLabel

Unicode Property Types

data CodePointStatus Source #

IDNA2008 code point status per RFC 5892.

Each Unicode code point is classified according to its validity for use in IDN labels.

Constructors

PVALID

Always valid in domain names

DISALLOWED

Never valid in domain names

CONTEXTJ

Valid only in specific contexts (Join_Control)

CONTEXTO

Valid only in specific contexts (Other)

UNASSIGNED

Not assigned in this Unicode version

Instances

Instances details
Bounded CodePointStatus Source # 
Instance details

Defined in Data.Text.IDN.Types

Enum CodePointStatus Source # 
Instance details

Defined in Data.Text.IDN.Types

Generic CodePointStatus Source # 
Instance details

Defined in Data.Text.IDN.Types

Associated Types

type Rep CodePointStatus 
Instance details

Defined in Data.Text.IDN.Types

type Rep CodePointStatus = D1 ('MetaData "CodePointStatus" "Data.Text.IDN.Types" "idn-0.1.2.0-ECOO1RAUys73BxjjVgDeye" 'False) ((C1 ('MetaCons "PVALID" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "DISALLOWED" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "CONTEXTJ" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "CONTEXTO" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "UNASSIGNED" 'PrefixI 'False) (U1 :: Type -> Type))))
Show CodePointStatus Source # 
Instance details

Defined in Data.Text.IDN.Types

NFData CodePointStatus Source # 
Instance details

Defined in Data.Text.IDN.Types

Methods

rnf :: CodePointStatus -> () #

Eq CodePointStatus Source # 
Instance details

Defined in Data.Text.IDN.Types

Ord CodePointStatus Source # 
Instance details

Defined in Data.Text.IDN.Types

type Rep CodePointStatus Source # 
Instance details

Defined in Data.Text.IDN.Types

type Rep CodePointStatus = D1 ('MetaData "CodePointStatus" "Data.Text.IDN.Types" "idn-0.1.2.0-ECOO1RAUys73BxjjVgDeye" 'False) ((C1 ('MetaCons "PVALID" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "DISALLOWED" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "CONTEXTJ" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "CONTEXTO" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "UNASSIGNED" 'PrefixI 'False) (U1 :: Type -> Type))))

data BidiClass Source #

Unicode bidirectional character class per Unicode Character Database (UCD).

Used for bidirectional text validation per RFC 5893.

Constructors

L

Left-to-Right

R

Right-to-Left

AL

Right-to-Left Arabic

AN

Arabic Number

EN

European Number

ES

European Number Separator

ET

European Number Terminator

CS

Common Number Separator

NSM

Nonspacing Mark

BN

Boundary Neutral

B

Paragraph Separator

S

Segment Separator

WS

Whitespace

ON

Other Neutral

LRE

Left-to-Right Embedding

LRO

Left-to-Right Override

RLE

Right-to-Left Embedding

RLO

Right-to-Left Override

PDF

Pop Directional Format

LRI

Left-to-Right Isolate

RLI

Right-to-Left Isolate

FSI

First Strong Isolate

PDI

Pop Directional Isolate

Instances

Instances details
Bounded BidiClass Source # 
Instance details

Defined in Data.Text.IDN.Types

Enum BidiClass Source # 
Instance details

Defined in Data.Text.IDN.Types

Generic BidiClass Source # 
Instance details

Defined in Data.Text.IDN.Types

Associated Types

type Rep BidiClass 
Instance details

Defined in Data.Text.IDN.Types

type Rep BidiClass = D1 ('MetaData "BidiClass" "Data.Text.IDN.Types" "idn-0.1.2.0-ECOO1RAUys73BxjjVgDeye" 'False) ((((C1 ('MetaCons "L" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "R" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "AL" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "AN" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "EN" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "ES" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ET" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CS" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "NSM" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "BN" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "B" 'PrefixI 'False) (U1 :: Type -> Type))))) :+: (((C1 ('MetaCons "S" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "WS" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ON" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "LRE" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "LRO" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "RLE" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "RLO" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "PDF" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "LRI" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "RLI" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "FSI" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "PDI" 'PrefixI 'False) (U1 :: Type -> Type))))))
Show BidiClass Source # 
Instance details

Defined in Data.Text.IDN.Types

NFData BidiClass Source # 
Instance details

Defined in Data.Text.IDN.Types

Methods

rnf :: BidiClass -> () #

Eq BidiClass Source # 
Instance details

Defined in Data.Text.IDN.Types

Ord BidiClass Source # 
Instance details

Defined in Data.Text.IDN.Types

type Rep BidiClass Source # 
Instance details

Defined in Data.Text.IDN.Types

type Rep BidiClass = D1 ('MetaData "BidiClass" "Data.Text.IDN.Types" "idn-0.1.2.0-ECOO1RAUys73BxjjVgDeye" 'False) ((((C1 ('MetaCons "L" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "R" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "AL" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "AN" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "EN" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "ES" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ET" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CS" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "NSM" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "BN" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "B" 'PrefixI 'False) (U1 :: Type -> Type))))) :+: (((C1 ('MetaCons "S" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "WS" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ON" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "LRE" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "LRO" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "RLE" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "RLO" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "PDF" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "LRI" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "RLI" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "FSI" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "PDI" 'PrefixI 'False) (U1 :: Type -> Type))))))

data ContextRule Source #

Contextual validation rules from RFC 5892 Appendix A.

Some code points are only valid in specific contexts. These rules define those contexts.

Constructors

ZWNJRule

A.1: Zero Width Non-Joiner (U+200C)

ZWJRule

A.2: Zero Width Joiner (U+200D)

MiddleDotRule

A.3: Middle Dot (U+00B7)

GreekKeraiaRule

A.4: Greek Lower Numeral Sign (U+0375)

HebrewGereshRule

A.5: Hebrew Punctuation Geresh (U+05F3)

HebrewGershayimRule

A.6: Hebrew Punctuation Gershayim (U+05F4)

KatakanaMiddleDotRule

A.7: Katakana Middle Dot (U+30FB)

ArabicIndicDigitsRule

A.8: Arabic-Indic Digits (U+0660..U+0669)

ExtendedArabicIndicDigitsRule

A.9: Extended Arabic-Indic Digits (U+06F0..U+06F9)

Instances

Instances details
Bounded ContextRule Source # 
Instance details

Defined in Data.Text.IDN.Types

Enum ContextRule Source # 
Instance details

Defined in Data.Text.IDN.Types

Generic ContextRule Source # 
Instance details

Defined in Data.Text.IDN.Types

Associated Types

type Rep ContextRule 
Instance details

Defined in Data.Text.IDN.Types

type Rep ContextRule = D1 ('MetaData "ContextRule" "Data.Text.IDN.Types" "idn-0.1.2.0-ECOO1RAUys73BxjjVgDeye" 'False) (((C1 ('MetaCons "ZWNJRule" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ZWJRule" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "MiddleDotRule" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "GreekKeraiaRule" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "HebrewGereshRule" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "HebrewGershayimRule" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "KatakanaMiddleDotRule" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ArabicIndicDigitsRule" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ExtendedArabicIndicDigitsRule" 'PrefixI 'False) (U1 :: Type -> Type)))))
Show ContextRule Source # 
Instance details

Defined in Data.Text.IDN.Types

NFData ContextRule Source # 
Instance details

Defined in Data.Text.IDN.Types

Methods

rnf :: ContextRule -> () #

Eq ContextRule Source # 
Instance details

Defined in Data.Text.IDN.Types

Ord ContextRule Source # 
Instance details

Defined in Data.Text.IDN.Types

type Rep ContextRule Source # 
Instance details

Defined in Data.Text.IDN.Types

type Rep ContextRule = D1 ('MetaData "ContextRule" "Data.Text.IDN.Types" "idn-0.1.2.0-ECOO1RAUys73BxjjVgDeye" 'False) (((C1 ('MetaCons "ZWNJRule" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ZWJRule" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "MiddleDotRule" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "GreekKeraiaRule" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "HebrewGereshRule" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "HebrewGershayimRule" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "KatakanaMiddleDotRule" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ArabicIndicDigitsRule" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ExtendedArabicIndicDigitsRule" 'PrefixI 'False) (U1 :: Type -> Type)))))

data BidiRule Source #

Bidirectional text rules from RFC 5893.

These rules ensure proper bidirectional text handling in RTL labels.

Constructors

Rule1

Presence of RTL characters triggers RTL validation

Rule2

First character must be R or AL

Rule3

Last character must be R, AL, AN, or EN

Rule4

NSM may only follow allowed character types

Rule5

ES and CS constraints in RTL labels

Rule6

EN and AN cannot be mixed

Instances

Instances details
Bounded BidiRule Source # 
Instance details

Defined in Data.Text.IDN.Types

Enum BidiRule Source # 
Instance details

Defined in Data.Text.IDN.Types

Generic BidiRule Source # 
Instance details

Defined in Data.Text.IDN.Types

Associated Types

type Rep BidiRule 
Instance details

Defined in Data.Text.IDN.Types

type Rep BidiRule = D1 ('MetaData "BidiRule" "Data.Text.IDN.Types" "idn-0.1.2.0-ECOO1RAUys73BxjjVgDeye" 'False) ((C1 ('MetaCons "Rule1" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Rule2" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Rule3" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "Rule4" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Rule5" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Rule6" 'PrefixI 'False) (U1 :: Type -> Type))))

Methods

from :: BidiRule -> Rep BidiRule x #

to :: Rep BidiRule x -> BidiRule #

Show BidiRule Source # 
Instance details

Defined in Data.Text.IDN.Types

NFData BidiRule Source # 
Instance details

Defined in Data.Text.IDN.Types

Methods

rnf :: BidiRule -> () #

Eq BidiRule Source # 
Instance details

Defined in Data.Text.IDN.Types

Ord BidiRule Source # 
Instance details

Defined in Data.Text.IDN.Types

type Rep BidiRule Source # 
Instance details

Defined in Data.Text.IDN.Types

type Rep BidiRule = D1 ('MetaData "BidiRule" "Data.Text.IDN.Types" "idn-0.1.2.0-ECOO1RAUys73BxjjVgDeye" 'False) ((C1 ('MetaCons "Rule1" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Rule2" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Rule3" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "Rule4" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Rule5" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Rule6" 'PrefixI 'False) (U1 :: Type -> Type))))

data Script Source #

Unicode script assignment.

Scripts are used for contextual validation of certain code points.

Instances

Instances details
Bounded Script Source # 
Instance details

Defined in Data.Text.IDN.Types

Enum Script Source # 
Instance details

Defined in Data.Text.IDN.Types

Generic Script Source # 
Instance details

Defined in Data.Text.IDN.Types

Associated Types

type Rep Script 
Instance details

Defined in Data.Text.IDN.Types

type Rep Script = D1 ('MetaData "Script" "Data.Text.IDN.Types" "idn-0.1.2.0-ECOO1RAUys73BxjjVgDeye" 'False) ((((C1 ('MetaCons "Latin" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Greek" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Cyrillic" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "Hebrew" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Arabic" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Devanagari" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "Bengali" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Gurmukhi" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Gujarati" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "Oriya" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Tamil" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Telugu" 'PrefixI 'False) (U1 :: Type -> Type))))) :+: (((C1 ('MetaCons "Kannada" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Malayalam" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Thai" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "Lao" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Tibetan" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Myanmar" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "Georgian" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Hangul" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Hiragana" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "Katakana" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Han" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "OtherScript" 'PrefixI 'False) (U1 :: Type -> Type))))))

Methods

from :: Script -> Rep Script x #

to :: Rep Script x -> Script #

Show Script Source # 
Instance details

Defined in Data.Text.IDN.Types

NFData Script Source # 
Instance details

Defined in Data.Text.IDN.Types

Methods

rnf :: Script -> () #

Eq Script Source # 
Instance details

Defined in Data.Text.IDN.Types

Methods

(==) :: Script -> Script -> Bool #

(/=) :: Script -> Script -> Bool #

Ord Script Source # 
Instance details

Defined in Data.Text.IDN.Types

type Rep Script Source # 
Instance details

Defined in Data.Text.IDN.Types

type Rep Script = D1 ('MetaData "Script" "Data.Text.IDN.Types" "idn-0.1.2.0-ECOO1RAUys73BxjjVgDeye" 'False) ((((C1 ('MetaCons "Latin" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Greek" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Cyrillic" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "Hebrew" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Arabic" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Devanagari" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "Bengali" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Gurmukhi" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Gujarati" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "Oriya" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Tamil" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Telugu" 'PrefixI 'False) (U1 :: Type -> Type))))) :+: (((C1 ('MetaCons "Kannada" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Malayalam" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Thai" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "Lao" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Tibetan" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Myanmar" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "Georgian" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Hangul" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Hiragana" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "Katakana" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Han" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "OtherScript" 'PrefixI 'False) (U1 :: Type -> Type))))))

Punycode Types

data PunycodeState Source #

Punycode algorithm state per RFC 3492.

Internal state used during Punycode encoding/decoding. Not typically needed by users of the library.

Constructors

PunycodeState 

Fields

  • n :: !Int

    Next code point to encode

  • delta :: !Int

    Delta value for encoding

  • bias :: !Int

    Bias for variable-length integer encoding

  • h :: !Int

    Number of code points handled

Instances

Instances details
Generic PunycodeState Source # 
Instance details

Defined in Data.Text.IDN.Types

Associated Types

type Rep PunycodeState 
Instance details

Defined in Data.Text.IDN.Types

type Rep PunycodeState = D1 ('MetaData "PunycodeState" "Data.Text.IDN.Types" "idn-0.1.2.0-ECOO1RAUys73BxjjVgDeye" 'False) (C1 ('MetaCons "PunycodeState" 'PrefixI 'True) ((S1 ('MetaSel ('Just "n") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Int) :*: S1 ('MetaSel ('Just "delta") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Int)) :*: (S1 ('MetaSel ('Just "bias") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Int) :*: S1 ('MetaSel ('Just "h") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Int))))
Show PunycodeState Source # 
Instance details

Defined in Data.Text.IDN.Types

NFData PunycodeState Source # 
Instance details

Defined in Data.Text.IDN.Types

Methods

rnf :: PunycodeState -> () #

Eq PunycodeState Source # 
Instance details

Defined in Data.Text.IDN.Types

type Rep PunycodeState Source # 
Instance details

Defined in Data.Text.IDN.Types

type Rep PunycodeState = D1 ('MetaData "PunycodeState" "Data.Text.IDN.Types" "idn-0.1.2.0-ECOO1RAUys73BxjjVgDeye" 'False) (C1 ('MetaCons "PunycodeState" 'PrefixI 'True) ((S1 ('MetaSel ('Just "n") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Int) :*: S1 ('MetaSel ('Just "delta") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Int)) :*: (S1 ('MetaSel ('Just "bias") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Int) :*: S1 ('MetaSel ('Just "h") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Int))))

data PunycodeParams Source #

Punycode algorithm parameters per RFC 3492.

Constants used in the Punycode algorithm. Not typically needed by users.

Constructors

PunycodeParams 

Fields

Instances

Instances details
Generic PunycodeParams Source # 
Instance details

Defined in Data.Text.IDN.Types

Associated Types

type Rep PunycodeParams 
Instance details

Defined in Data.Text.IDN.Types

Show PunycodeParams Source # 
Instance details

Defined in Data.Text.IDN.Types

NFData PunycodeParams Source # 
Instance details

Defined in Data.Text.IDN.Types

Methods

rnf :: PunycodeParams -> () #

Eq PunycodeParams Source # 
Instance details

Defined in Data.Text.IDN.Types

type Rep PunycodeParams Source # 
Instance details

Defined in Data.Text.IDN.Types

initialState :: PunycodeState Source #

Initial Punycode state per RFC 3492.

Starting state for Punycode encoding operations.

punycodeParams :: PunycodeParams Source #

Standard Punycode parameters from RFC 3492.