+instance Indexed Headers CIAscii Ascii where
+ {-# INLINE index #-}
+ index k (Headers m) = index k m
+ {-# INLINE adjust #-}
+ adjust f k (Headers m) = Headers $ adjust f k m
+ {-# INLINE inDomain #-}
+ inDomain k (Headers m) = inDomain k m
+
+instance Monoid Headers where
+ {-# INLINE mempty #-}
+ mempty = empty
+ {-# INLINE mappend #-}
+ mappend (Headers α) (Headers β)
+ = Headers $ insertManySorted β α
+
+instance Map Headers CIAscii Ascii where
+ {-# INLINE lookup #-}
+ lookup k (Headers m) = lookup k m
+ {-# INLINE insertWith #-}
+ insertWith f k v (Headers m)
+ = Headers $ insertWith f k v m
+ {-# INLINE mapWithKey #-}
+ mapWithKey f (Headers m)
+ = Headers $ mapWithKey f m
+ {-# INLINE unionWith #-}
+ unionWith f (Headers α) (Headers β)
+ = Headers $ unionWith f α β
+ {-# INLINE intersectionWith #-}
+ intersectionWith f (Headers α) (Headers β)
+ = Headers $ intersectionWith f α β
+ {-# INLINE differenceWith #-}
+ differenceWith f (Headers α) (Headers β)
+ = Headers $ differenceWith f α β
+ {-# INLINE isSubmapBy #-}
+ isSubmapBy f (Headers α) (Headers β)
+ = isSubmapBy f α β
+ {-# INLINE isProperSubmapBy #-}
+ isProperSubmapBy f (Headers α) (Headers β)
+ = isProperSubmapBy f α β
+
+instance SortingCollection Headers (CIAscii, Ascii) where
+ {-# INLINE minView #-}
+ minView (Headers m) = second Headers <$> minView m
+
+merge ∷ Ascii → Ascii → Ascii
+{-# INLINE merge #-}
+merge a b
+ | nullA a ∧ nullA b = (∅)
+ | nullA a = b
+ | nullA b = a
+ | otherwise = a ⊕ ", " ⊕ b
+ where
+ nullA ∷ Ascii → Bool
+ {-# INLINE nullA #-}
+ nullA = null ∘ A.toByteString