-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/

-- | Email address validation
--   
--   Validating an email address string against RFC 5322
@package email-validate
@version 2.3.2.21

module Text.Email.Parser

-- | A parser for email addresses.
addrSpec :: Parser EmailAddress

-- | Extracts the local part of an email address.
localPart :: EmailAddress -> ByteString

-- | Extracts the domain part of an email address.
domainPart :: EmailAddress -> ByteString

-- | Represents an email address.
data EmailAddress

-- | Creates an email address without validating it. You should only use
--   this when reading data from somewhere it has already been validated
--   (e.g. a database).
unsafeEmailAddress :: ByteString -> ByteString -> EmailAddress

-- | Converts an email address back to a ByteString
toByteString :: EmailAddress -> ByteString
instance GHC.Internal.Data.Data.Data Text.Email.Parser.EmailAddress
instance GHC.Classes.Eq Text.Email.Parser.EmailAddress
instance GHC.Internal.Generics.Generic Text.Email.Parser.EmailAddress
instance GHC.Classes.Ord Text.Email.Parser.EmailAddress
instance GHC.Internal.Read.Read Text.Email.Parser.EmailAddress
instance GHC.Internal.Show.Show Text.Email.Parser.EmailAddress

module Text.Email.Validate

-- | Validates whether a particular string is an email address according to
--   RFC5322.
isValid :: ByteString -> Bool

-- | If you want to find out *why* a particular string is not an email
--   address, use this.
--   
--   Examples (both require OverloadedStrings to be enabled):
--   
--   
--   >>> validate "example@example.com"
--   Right "example@example.com"
--   
--   
--   
--   >>> validate "not.good"
--   Left "at sign > @: not enough input"
--   
validate :: ByteString -> Either String EmailAddress

-- | Smart constructor for an email address
emailAddress :: ByteString -> Maybe EmailAddress

-- | Checks that an email is valid and returns a version of it where
--   comments and whitespace have been removed.
--   
--   Example (requires OverloadedStrings to be enabled):
--   
--   
--   >>> canonicalizeEmail "spaces. are. allowed@example.com"
--   Just "spaces.are.allowed@example.com"
--   
canonicalizeEmail :: ByteString -> Maybe ByteString

-- | Represents an email address.
data EmailAddress

-- | Extracts the domain part of an email address.
domainPart :: EmailAddress -> ByteString

-- | Extracts the local part of an email address.
localPart :: EmailAddress -> ByteString

-- | Converts an email address back to a ByteString
toByteString :: EmailAddress -> ByteString

-- | Creates an email address without validating it. You should only use
--   this when reading data from somewhere it has already been validated
--   (e.g. a database).
unsafeEmailAddress :: ByteString -> ByteString -> EmailAddress

module Text.Email.QuasiQuotation

-- | A QuasiQuoter for email addresses.
--   
--   Use it like this (requires QuasiQuotes to be enabled):
--   
--   
--   >>> [email|someone@example.com|]
--   "someone@example.com"
--   
email :: QuasiQuoter
