]> gitweb @ CieloNegro.org - Lucu.git/blobdiff - Network/HTTP/Lucu/MIMEParams.hs
auto-derive SortingCollection
[Lucu.git] / Network / HTTP / Lucu / MIMEParams.hs
index 1304c2328a5db1fd3931e332b07948928dc32bdb..a3722a34958bfae90194a724e823c5c380fca553 100644 (file)
@@ -11,7 +11,7 @@
   , 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>).
@@ -22,7 +22,6 @@ module Network.HTTP.Lucu.MIMEParams
     )
     where
 import Control.Applicative hiding (empty)
-import Control.Arrow
 import Control.Monad hiding (mapM)
 import Control.Monad.Unicode
 import Data.Ascii (Ascii, CIAscii, AsciiBuilder)
@@ -58,31 +57,13 @@ newtype MIMEParams
     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 #-}
@@ -106,11 +87,6 @@ instance Map MIMEParams CIAscii Text where
     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 #-}