diff --git a/src/Text/Email/QuasiQuotation.hs b/src/Text/Email/QuasiQuotation.hs index 02c5d06..d5ed641 100644 --- a/src/Text/Email/QuasiQuotation.hs +++ b/src/Text/Email/QuasiQuotation.hs @@ -17,9 +17,8 @@ import Text.Email.Validate (validate, localPart, domainPart, unsafeEmailAddress) -- | A QuasiQuoter for email addresses. -- --- Use it like this: +-- Use it like this (requires `QuasiQuotes` to be enabled): -- --- >>> :set -XQuasiQuotes -- >>> [email|someone@example.com|] -- "someone@example.com" email :: QuasiQuoter diff --git a/src/Text/Email/Validate.hs b/src/Text/Email/Validate.hs index 2fa686b..12dda1b 100644 --- a/src/Text/Email/Validate.hs +++ b/src/Text/Email/Validate.hs @@ -24,11 +24,6 @@ import Text.Email.Parser , toByteString , unsafeEmailAddress) --- $setup --- This is required for all examples: --- --- >>> :set -XOverloadedStrings - -- | Smart constructor for an email address emailAddress :: ByteString -> Maybe EmailAddress emailAddress = either (const Nothing) Just . validate @@ -36,7 +31,7 @@ emailAddress = either (const Nothing) Just . validate -- | Checks that an email is valid and returns a version of it -- where comments and whitespace have been removed. -- --- Example: +-- Example (requires `OverloadedStrings` to be enabled): -- -- >>> canonicalizeEmail "spaces. are. allowed@example.com" -- Just "spaces.are.allowed@example.com" @@ -51,7 +46,7 @@ isValid = either (const False) (const True) . validate -- | If you want to find out *why* a particular string is not -- an email address, use this. -- --- Examples: +-- Examples (both require `OverloadedStrings` to be enabled): -- -- >>> validate "example@example.com" -- Right "example@example.com" @@ -60,4 +55,3 @@ isValid = either (const False) (const True) . validate -- Left "at sign > @: not enough input" validate :: ByteString -> Either String EmailAddress validate = parseOnly (addrSpec >>= \r -> endOfInput >> return r) - diff --git a/tests/doctests.hs b/tests/doctests.hs index 4939ee7..b702239 100644 --- a/tests/doctests.hs +++ b/tests/doctests.hs @@ -4,4 +4,6 @@ main = doctest [ "-isrc" , "src/Text/Email/QuasiQuotation.hs" , "src/Text/Email/Validate.hs" + , "-XQuasiQuotes" + , "-XOverloadedStrings" ]