module HeaderName(HeaderName{-,headerName-},hn,orig,normal) where import Utils2(strToLower,mapR) -- | Header names for mail and HTTP, preserve original capitalization for -- printing but use case insensitive comparisons. data HeaderName = Name {orig ::String, -- ^ original capitalization normal::String -- ^ normalized capitalization } -- Invariant: n::Headername ==> normal n==strToLower (orig n) headerName orig = Name orig (strToLower orig) hn = headerName instance Eq HeaderName where n1==n2 = normal n1==normal n2 instance Ord HeaderName where compare n1 n2 = compare (normal n1) (normal n2) instance Show HeaderName where showsPrec d = showsPrec d . orig instance Read HeaderName where readsPrec d = mapR headerName . readsPrec d