addy-0.1.0.1: A full-featured library for parsing, validating, and rendering email addresses
CopyrightThis file is part of the package addy. It is subject to the license
terms in the LICENSE file found in the top-level directory of this
distribution and at:

https://code.devalot.com/open/addy

No part of this package including this file may be copied
modified propagated or distributed except according to the terms
contained in the LICENSE file.
LicenseBSD-2-Clause
Safe HaskellNone
LanguageHaskell2010

Addy.Internal.Types

Description

The module exports internal types along with their constructors.

The rendering code relies on the newtype wrappers around Text to keep out invalid characters. Prefer to use the official interface if possible.

Synopsis

Documentation

data Error Source #

Potential validation errors.

Since: 0.1.0.0

Constructors

InvalidPrefixError Text

A component of an email address may not start with the recorded prefix text.

InvalidSuffixError Text

A component of an email address may not end with the recorded suffix text.

InvalidCharactersError Text

A component of an email address contains invalid characters.

InvalidLengthError Int Int Int

A component of an email address does not meet the set length requirements. The values in this constructor are min, max, and actual.

ParserFailedError Text

The input to the address decoder was not a valid email address and produced the recorded error message.

Instances

Instances details
Eq Error Source # 
Instance details

Defined in Addy.Internal.Types

Methods

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

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

Show Error Source # 
Instance details

Defined in Addy.Internal.Types

Methods

showsPrec :: Int -> Error -> ShowS #

show :: Error -> String #

showList :: [Error] -> ShowS #

data EmailAddr Source #

The representation of a complete email address.

The parser preserves optional components such as the display name and comments. The rendering code can optionally include these optional elements when turning the address back into Text.

Since: 0.1.0.0

Instances

Instances details
Show EmailAddr Source # 
Instance details

Defined in Addy.Internal.Render

displayName :: Lens' EmailAddr (Maybe DisplayName) Source #

Optional display name. Addresses in the name-addr format from RFC 5322 allow descriptive text to precede the address. This is commonly used in email messages to list the name of the address' owner.

Since: 0.1.0.0

localPart :: Lens' EmailAddr LocalPart Source #

The LocalPart of an email address usually references the destination mailbox on the Domain server. However, the content of the LocalPart can only be understood by the receiving Domain.

Since: 0.1.0.0

domain :: Lens' EmailAddr Domain Source #

The Domain refers to the fully-qualified domain name that accepts mail for the associated LocalPart. See the documentation for the Domain type for more details.

Since: 0.1.0.0

comments :: Lens' EmailAddr [Comment] Source #

Addresses in both the name-addr and addr-spec formats support comments.

Since: 0.1.0.0

newtype DisplayName Source #

Optional display name. Usually this is the name of the person who receives email at the associated address.

Display Name <example@example.com>

Since: 0.1.0.0

Constructors

DP 

newtype LocalPart Source #

The name of the mailbox on the associated Domain.

Since: 0.1.0.0

Constructors

LP 

Fields

Instances

Instances details
Eq LocalPart Source # 
Instance details

Defined in Addy.Internal.Types

Show LocalPart Source # 
Instance details

Defined in Addy.Internal.Types

Semigroup LocalPart Source # 
Instance details

Defined in Addy.Internal.Types

data Domain Source #

A fully-qualified domain name or an address literal.

Most email addresses use a domain name. However, it's perfectly legal to use an AddressLiteral instead.

Since: 0.1.0.0

Instances

Instances details
Eq Domain Source # 
Instance details

Defined in Addy.Internal.Types

Methods

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

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

Show Domain Source # 
Instance details

Defined in Addy.Internal.Types

_Domain :: Prism' Domain DomainName Source #

Prism for working with domain names.

Since: 0.1.0.0

_DomainLiteral :: Prism' Domain AddressLiteral Source #

Prism for working with domain literals.

Since: 0.1.0.0

newtype DomainName Source #

A fully-qualified domain name which is made up of a list of host names (labels) separated by dots.

Since: 0.1.0.0

Constructors

DN 

Fields

Instances

Instances details
Eq DomainName Source # 
Instance details

Defined in Addy.Internal.Types

Show DomainName Source # 
Instance details

Defined in Addy.Internal.Types

Semigroup DomainName Source # 
Instance details

Defined in Addy.Internal.Types

newtype HostName Source #

The name of one host component of a domain name.

Since: 0.1.0.0

Constructors

HN 

Fields

Instances

Instances details
Eq HostName Source # 
Instance details

Defined in Addy.Internal.Types

Show HostName Source # 
Instance details

Defined in Addy.Internal.Types

Semigroup HostName Source # 
Instance details

Defined in Addy.Internal.Types

_HostNames :: Iso' DomainName [HostName] Source #

Iso for converting between domain names and a list of host names.

>>> "gmail.uk.co" ^. _DomainName._HostNames & map (review _HostName)
["gmail","uk","co"]

Since: 0.1.0.0

data AddressLiteral Source #

Address literals can be used instead of a domain name to direct mail to a specific IP address or other tagged address type.

Example email addresses with address literals:

example@[127.0.0.1]
example@[IPv6:1111:2222:3333:4444:5555:6666:7777]
example@[Just-some-text]

Since: 0.1.0.0

Constructors

IpAddressLiteral IP

A literal IP address as defined in RFC 5321 §4.1.3. The address can be in many formats so it is presented here in its parsed form.

TaggedAddressLiteral AddressTag Literal

RFC 5321 also defines a general address literal where a standardized tag precedes the address itself. The only information provided about the standardized tag is:

Standardized-tag MUST be specified in a
Standards-Track RFC and registered with IANA
AddressLiteral Literal

RFC 5322 defines a domain-literal as (roughly) a span of characters that are allowed in a domain name. The interpretation of those characters is left to "separate documents" such as RFC 5321.

If an address literal cannot be parsed in one of the proceeding formats it is encoded as a Literal value.

Instances

Instances details
Eq AddressLiteral Source # 
Instance details

Defined in Addy.Internal.Types

Show AddressLiteral Source # 
Instance details

Defined in Addy.Internal.Types

_IpAddressLiteral :: Prism' AddressLiteral IP Source #

Prism for working with IP address literals.

Since: 0.1.0.0

_TaggedAddressLiteral :: Prism' AddressLiteral (AddressTag, Literal) Source #

Prism for working with tagged address literals.

Since: 0.1.0.0

_AddressLiteral :: Prism' AddressLiteral Literal Source #

Prism for working with address literals.

Since: 0.1.0.0

newtype AddressTag Source #

A tag that can be used with a TaggedAddressLiteral.

Since: 0.1.0.0

Constructors

AT 

Fields

Instances

Instances details
Eq AddressTag Source # 
Instance details

Defined in Addy.Internal.Types

Show AddressTag Source # 
Instance details

Defined in Addy.Internal.Types

Semigroup AddressTag Source # 
Instance details

Defined in Addy.Internal.Types

newtype Literal Source #

A literal address that can be used with a TaggedAddressLiteral or AddressLiteral.

Since: 0.1.0.0

Constructors

Lit 

Fields

Instances

Instances details
Eq Literal Source # 
Instance details

Defined in Addy.Internal.Types

Methods

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

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

Show Literal Source # 
Instance details

Defined in Addy.Internal.Types

Semigroup Literal Source # 
Instance details

Defined in Addy.Internal.Types

data Comment Source #

A comment which may appear in an email address in a specific location.

Since: 0.1.0.0

Instances

Instances details
Eq Comment Source # 
Instance details

Defined in Addy.Internal.Types

Methods

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

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

Show Comment Source # 
Instance details

Defined in Addy.Internal.Types

_Comment :: Prism' Comment (CommentLoc, CommentContent) Source #

Prism for working with a Comment.

Since: 0.1.0.0

commentLoc :: Lens' Comment CommentLoc Source #

Lens for working with comment locations.

Since: 0.1.0.0

commentContent :: Lens' Comment CommentContent Source #

Lens for working with comment contents.

Since: 0.1.0.0

data CommentLoc Source #

The location where a comment was parsed or where it should be rendered.

Since: 0.1.0.0

Constructors

BeforeDisplayName

Just before the DisplayName.

AfterDisplayName

Just after the DisplayName but before the address.

BeforeLocalPart

Before the LocalPart of the address.

AfterDomain

After the Domain.

AfterAddress

After the complete address.

Instances

Instances details
Eq CommentLoc Source # 
Instance details

Defined in Addy.Internal.Types

Show CommentLoc Source # 
Instance details

Defined in Addy.Internal.Types

newtype CommentContent Source #

Text that can appear in a comment.

Since: 0.1.0.0

Constructors

CC