email-validate-hs
email-validate-hs copied to clipboard
Use CaseInsensitive for domain part to follow RFC
According to RFC 1035, section 3.1:
Name servers and resolvers must compare [domains] in a case-insensitive manner
So I believe the Eq
and Ord
instances of EmailAddress
should take it into account. This PR implements it in a API preserving way which didn't need tweaking any tests by using Data.CaseInsensitive.CI
to store the domain part- A domainPartOriginal
is provided to extract it in the original case in which it was parsed. Perhaps, fort better backwards compatibility, it should be the other way around? (ie: provide a domainPartFoldedCase
to extract it folded and leave domainPart
returning the original case)
I think it makes sense for the domain part but it’s going to be a breaking change to do this so would need to be in a major version update. The local part should not be case-insensitive as the interpretation is meant to be entirely up to the destination server (which could allow case-sensitive emails, although that would be unusual!)
Indeed! The local part change slipped in, it’s something we finally decided to do internally and wasn’t intended to be proposed upstream. I’ll clean that up and bump version tomorrow
ping