-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
It looks like headerContentID is not a valid Lens, because parse failure maps to Nothing, whilst setting Nothing removes the header in question from the list of headers. Thus set l (view l s) s = s is violated. Perhaps consider making it a Traversal' a ContentID instead?
> import Data.MIME
> import Data.IMF.Syntax
> import Data.String
> let l = headerContentID
> let s = Headers [(mk (fromString "Message-ID"), fromString "! unparseable !")]
> import Control.Lens
> set l (view l s) s
Headers []
> s
Headers [("Message-ID","! unparseable !")](Using Message-ID in this example because of #75)
purebred-email/src/Data/MIME.hs
Lines 922 to 926 in 84ab531
| headerContentID :: (HasHeaders a) => Lens' a (Maybe ContentID) | |
| headerContentID = headers . at "Message-ID" . iso (>>= f) (fmap g) | |
| where | |
| f = either (const Nothing) Just . parseOnly (parseContentID <* endOfInput) | |
| g = renderContentID |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels