--- FIXME: auto-derive
-instance Map MIMEParams CIAscii Text where
- {-# INLINE lookup #-}
- lookup k (MIMEParams m) = lookup k m
- {-# INLINE mapWithKey #-}
- mapWithKey f (MIMEParams m)
- = MIMEParams $ mapWithKey f m
- {-# INLINE unionWith #-}
- unionWith f (MIMEParams α) (MIMEParams β)
- = MIMEParams $ unionWith f α β
- {-# INLINE intersectionWith #-}
- intersectionWith f (MIMEParams α) (MIMEParams β)
- = MIMEParams $ intersectionWith f α β
- {-# INLINE differenceWith #-}
- differenceWith f (MIMEParams α) (MIMEParams β)
- = MIMEParams $ differenceWith f α β
- {-# INLINE isSubmapBy #-}
- isSubmapBy f (MIMEParams α) (MIMEParams β)
- = isSubmapBy f α β
- {-# INLINE isProperSubmapBy #-}
- isProperSubmapBy f (MIMEParams α) (MIMEParams β)
- = isProperSubmapBy f α β
-
--- FIXME: auto-derive
-instance SortingCollection MIMEParams (CIAscii, Text) where
- {-# INLINE minView #-}
- minView (MIMEParams m) = second MIMEParams <$> minView m
-
--- |Convert MIME parameter values to an 'AsciiBuilder'.
-printMIMEParams ∷ MIMEParams → AsciiBuilder
-{-# INLINEABLE printMIMEParams #-}
-printMIMEParams = foldl' f (∅)
- where
- f ∷ AsciiBuilder → (CIAscii, Text) → AsciiBuilder
- {-# INLINE f #-}
- f ab (k, v) = ab ⊕ A.toAsciiBuilder "; " ⊕ printPair k v
+instance ConvertSuccess MIMEParams AsciiBuilder where
+ {-# INLINEABLE convertSuccess #-}
+ convertSuccess = foldl' f (∅)
+ where
+ f ∷ AsciiBuilder → (CIAscii, Text) → AsciiBuilder
+ {-# INLINE f #-}
+ f ab (k, v) = ab ⊕ cs ("; " ∷ Ascii) ⊕ printPair k v