X-Git-Url: http://git.cielonegro.org/gitweb.cgi?a=blobdiff_plain;f=Network%2FHTTP%2FLucu%2FMIMEType%2FGuess.hs;h=6a791e4d15792a5aaff5a4504ceb6e10930e7a22;hb=bb41be0c967538a1014c87103a3a5d3840ad3e15;hp=edf177276eecc6feaf98be043ce13f96b3083e0d;hpb=19043d7882f936be9b073cae34b52905016c3ad7;p=Lucu.git diff --git a/Network/HTTP/Lucu/MIMEType/Guess.hs b/Network/HTTP/Lucu/MIMEType/Guess.hs index edf1772..6a791e4 100644 --- a/Network/HTTP/Lucu/MIMEType/Guess.hs +++ b/Network/HTTP/Lucu/MIMEType/Guess.hs @@ -17,8 +17,8 @@ module Network.HTTP.Lucu.MIMEType.Guess ) where import Control.Applicative -import Data.Attoparsec.Char8 as P -import Data.Attoparsec.Lazy as LP +import Data.Attoparsec.Char8 +import qualified Data.Attoparsec.Lazy as LP import qualified Data.ByteString.Lazy.Char8 as Lazy import qualified Data.Map as M import Data.Map (Map) @@ -32,8 +32,8 @@ import Data.Text.Encoding import Language.Haskell.TH.Syntax import Language.Haskell.TH.Quote import Network.HTTP.Lucu.MIMEType +import Network.HTTP.Lucu.OrphanInstances () import Network.HTTP.Lucu.Parser -import Network.HTTP.Lucu.Utils import Prelude.Unicode import System.FilePath @@ -43,8 +43,7 @@ newtype ExtMap deriving (Eq, Show, Read, Monoid, Typeable) instance Lift ExtMap where - lift (ExtMap m) - = [| ExtMap $(liftMap liftText lift m) |] + lift (ExtMap m) = [| ExtMap $(lift m) |] -- |'QuasiQuoter' for 'ExtMap' reading Apache @mime.types@. -- @@ -104,7 +103,7 @@ parseExtMap src "pair" ext ∷ Parser Text - ext = (decodeUtf8 <$> P.takeWhile1 isAlphaNum) + ext = (decodeUtf8 <$> takeWhile1 isAlphaNum) "ext" @@ -118,7 +117,7 @@ parseExtMap src "linebreak" compile ∷ Ord k ⇒ [(v, [k])] → Either (k, v, v) (Map k v) -compile = go (∅) ∘ concat ∘ map tr +compile = go (∅) ∘ concat ∘ (tr <$>) where tr ∷ (v, [k]) → [(k, v)] tr (v, ks) = [(k, v) | k ← ks]