I needed to parse only localparts of mail addresses and came across this library but realized that it wasn't working as I thought it would:
parseOnly (localPartP Strict) "test"
-- Left "local part > quoted content > '\"': Failed reading: satisfy"
parseOnly (localPartP Lenient) "test"
-- Left "local part: Failed reading: empty"
parseOnly (localPartP Strict) "test@"
-- Right (Nothing,LocalPart "test")
parseOnly (localPartP Lenient) "test@"
-- Right (Nothing,LocalPart "test")
But I also know that the @ is not consumed by localPartP because this parser succeeds:
parseOnly (localPartP Lenient <* char '@') "test@"
-- Right (Nothing,LocalPart "test")
So I don't know if this is to be considered a bug or if localPartP needs documentation that it can only succeed if it is followed by a @.
For my use case this won't be a blocker either way since I decided to parse only a restricted form of localparts and use your nice library to do validation afterwards.
I needed to parse only localparts of mail addresses and came across this library but realized that it wasn't working as I thought it would:
But I also know that the
@is not consumed bylocalPartPbecause this parser succeeds:So I don't know if this is to be considered a bug or if
localPartPneeds documentation that it can only succeed if it is followed by a@.For my use case this won't be a blocker either way since I decided to parse only a restricted form of localparts and use your nice library to do validation afterwards.