, UnicodeSyntax
#-}
{-# OPTIONS_GHC -ddump-splices #-} -- FIXME
--- GHC 7.0.3 gives us a false warning.
+-- THINKME: GHC 7.0.3 gives us a false warning.
{-# OPTIONS_GHC -fno-warn-missing-methods #-}
-- |Parsing and printing MIME parameter values
-- (<http://tools.ietf.org/html/rfc2231>).
)
where
import Control.Applicative hiding (empty)
-import Control.Arrow
import Control.Monad hiding (mapM)
import Control.Monad.Unicode
import Data.Ascii (Ascii, CIAscii, AsciiBuilder)
deriving (Eq, Show, Read, Monoid, Typeable)
C.derive [d| instance Unfoldable MIMEParams (CIAscii, Text)
+ instance Foldable MIMEParams (CIAscii, Text)
+ instance Collection MIMEParams (CIAscii, Text)
+ instance Indexed MIMEParams CIAscii Text
+ -- instance Map MIMEParams CIAscii Text
+ instance SortingCollection MIMEParams (CIAscii, Text)
|]
--- FIXME: auto-derive
-instance Foldable MIMEParams (CIAscii, Text) where
- {-# INLINE null #-}
- null (MIMEParams m) = null m
- {-# INLINE size #-}
- size (MIMEParams m) = size m
- {-# INLINE foldr #-}
- foldr f b (MIMEParams m) = foldr f b m
-
--- FIXME: auto-derive
-instance Collection MIMEParams (CIAscii, Text) where
- {-# INLINE filter #-}
- filter f (MIMEParams m) = MIMEParams $ filter f m
-
--- FIXME: auto-derive
-instance Indexed MIMEParams CIAscii Text where
- {-# INLINE index #-}
- index k (MIMEParams m) = index k m
- {-# INLINE adjust #-}
- adjust f k (MIMEParams m) = MIMEParams $ adjust f k m
- {-# INLINE inDomain #-}
- inDomain k (MIMEParams m) = inDomain k m
-
-- FIXME: auto-derive
instance Map MIMEParams CIAscii Text where
{-# INLINE lookup #-}
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 #-}