| Copyright | This 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. |
|---|---|
| License | BSD-2-Clause |
| Safe Haskell | None |
| Language | Haskell2010 |
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
- data Error
- data EmailAddr = EmailAddr {
- _displayName :: Maybe DisplayName
- _localPart :: LocalPart
- _domain :: Domain
- _comments :: [Comment]
- displayName :: Lens' EmailAddr (Maybe DisplayName)
- localPart :: Lens' EmailAddr LocalPart
- domain :: Lens' EmailAddr Domain
- comments :: Lens' EmailAddr [Comment]
- newtype DisplayName = DP {}
- newtype LocalPart = LP {}
- data Domain
- _Domain :: Prism' Domain DomainName
- _DomainLiteral :: Prism' Domain AddressLiteral
- newtype DomainName = DN {}
- newtype HostName = HN {
- hostNameText :: Text
- _HostNames :: Iso' DomainName [HostName]
- data AddressLiteral
- _IpAddressLiteral :: Prism' AddressLiteral IP
- _TaggedAddressLiteral :: Prism' AddressLiteral (AddressTag, Literal)
- _AddressLiteral :: Prism' AddressLiteral Literal
- newtype AddressTag = AT {}
- newtype Literal = Lit {
- literalText :: Text
- data Comment = Comment CommentLoc CommentContent
- _Comment :: Prism' Comment (CommentLoc, CommentContent)
- commentLoc :: Lens' Comment CommentLoc
- commentContent :: Lens' Comment CommentContent
- data CommentLoc
- newtype CommentContent = CC {}
Documentation
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 |
| ParserFailedError Text | The input to the address decoder was not a valid email address and produced the recorded error message. |
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
Constructors
| EmailAddr | |
Fields
| |
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
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 | |
Fields | |
Instances
| Eq DisplayName Source # | |
Defined in Addy.Internal.Types | |
| Show DisplayName Source # | |
Defined in Addy.Internal.Types Methods showsPrec :: Int -> DisplayName -> ShowS # show :: DisplayName -> String # showList :: [DisplayName] -> ShowS # | |
| Semigroup DisplayName Source # | |
Defined in Addy.Internal.Types Methods (<>) :: DisplayName -> DisplayName -> DisplayName # sconcat :: NonEmpty DisplayName -> DisplayName # stimes :: Integral b => b -> DisplayName -> DisplayName # | |
The name of the mailbox on the associated Domain.
Since: 0.1.0.0
Constructors
| LP | |
Fields | |
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
Constructors
| Domain DomainName | |
| DomainLiteral AddressLiteral |
_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
| Eq DomainName Source # | |
Defined in Addy.Internal.Types | |
| Show DomainName Source # | |
Defined in Addy.Internal.Types Methods showsPrec :: Int -> DomainName -> ShowS # show :: DomainName -> String # showList :: [DomainName] -> ShowS # | |
| Semigroup DomainName Source # | |
Defined in Addy.Internal.Types Methods (<>) :: DomainName -> DomainName -> DomainName # sconcat :: NonEmpty DomainName -> DomainName # stimes :: Integral b => b -> DomainName -> DomainName # | |
The name of one host component of a domain name.
Since: 0.1.0.0
Constructors
| HN | |
Fields
| |
_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 If an address literal cannot be parsed in one of the proceeding
formats it is encoded as a |
Instances
| Eq AddressLiteral Source # | |
Defined in Addy.Internal.Types Methods (==) :: AddressLiteral -> AddressLiteral -> Bool # (/=) :: AddressLiteral -> AddressLiteral -> Bool # | |
| Show AddressLiteral Source # | |
Defined in Addy.Internal.Types Methods showsPrec :: Int -> AddressLiteral -> ShowS # show :: AddressLiteral -> String # showList :: [AddressLiteral] -> ShowS # | |
_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
| Eq AddressTag Source # | |
Defined in Addy.Internal.Types | |
| Show AddressTag Source # | |
Defined in Addy.Internal.Types Methods showsPrec :: Int -> AddressTag -> ShowS # show :: AddressTag -> String # showList :: [AddressTag] -> ShowS # | |
| Semigroup AddressTag Source # | |
Defined in Addy.Internal.Types Methods (<>) :: AddressTag -> AddressTag -> AddressTag # sconcat :: NonEmpty AddressTag -> AddressTag # stimes :: Integral b => b -> AddressTag -> AddressTag # | |
A literal address that can be used with a TaggedAddressLiteral
or AddressLiteral.
Since: 0.1.0.0
Constructors
| Lit | |
Fields
| |
A comment which may appear in an email address in a specific location.
Since: 0.1.0.0
Constructors
| Comment CommentLoc CommentContent |
_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 |
| AfterDisplayName | Just after the |
| BeforeLocalPart | Before the |
| AfterDomain | After the |
| AfterAddress | After the complete address. |
Instances
| Eq CommentLoc Source # | |
Defined in Addy.Internal.Types | |
| Show CommentLoc Source # | |
Defined in Addy.Internal.Types Methods showsPrec :: Int -> CommentLoc -> ShowS # show :: CommentLoc -> String # showList :: [CommentLoc] -> ShowS # | |
newtype CommentContent Source #
Text that can appear in a comment.
Since: 0.1.0.0
Constructors
| CC | |
Fields | |
Instances
| Eq CommentContent Source # | |
Defined in Addy.Internal.Types Methods (==) :: CommentContent -> CommentContent -> Bool # (/=) :: CommentContent -> CommentContent -> Bool # | |
| Show CommentContent Source # | |
Defined in Addy.Internal.Types Methods showsPrec :: Int -> CommentContent -> ShowS # show :: CommentContent -> String # showList :: [CommentContent] -> ShowS # | |
| Semigroup CommentContent Source # | |
Defined in Addy.Internal.Types Methods (<>) :: CommentContent -> CommentContent -> CommentContent # sconcat :: NonEmpty CommentContent -> CommentContent # stimes :: Integral b => b -> CommentContent -> CommentContent # | |