X-Git-Url: http://git.cielonegro.org/gitweb.cgi?p=Lucu.git;a=blobdiff_plain;f=Network%2FHTTP%2FLucu%2FImplant%2FPrettyPrint.hs;h=22e3a74538c3a3342a74979c45d60382a3742c63;hp=5bbc36d8d470508904ce8247485d9ef0947ce72b;hb=0678be8;hpb=97295ba748af07f3b0b609f32aabdd52167d9799 diff --git a/Network/HTTP/Lucu/Implant/PrettyPrint.hs b/Network/HTTP/Lucu/Implant/PrettyPrint.hs index 5bbc36d..22e3a74 100644 --- a/Network/HTTP/Lucu/Implant/PrettyPrint.hs +++ b/Network/HTTP/Lucu/Implant/PrettyPrint.hs @@ -1,5 +1,7 @@ {-# LANGUAGE DoAndIfThenElse + , FlexibleContexts + , MultiParamTypeClasses , OverloadedStrings , RecordWildCards , TemplateHaskell @@ -15,10 +17,10 @@ module Network.HTTP.Lucu.Implant.PrettyPrint import Codec.Compression.GZip import Control.Monad import Data.Ascii (Ascii, CIAscii) -import qualified Data.Ascii as A import qualified Data.ByteString.Lazy as L import Data.Char import Data.Collections +import Data.Convertible.Base import Data.Convertible.Utils import Data.List (intersperse) import Data.Monoid @@ -60,19 +62,16 @@ header i@(Input {..}) ] else text " Compression: disabled" - , text " MIME Type:" <+> mimeTypeToDoc iType - , text " ETag:" <+> eTagToDoc iETag + , text " MIME Type:" <+> toDoc iType + , text " ETag:" <+> toDoc iETag , text " Last Modified:" <+> text (show iLastMod) ] , text " -}" , text "{-# LANGUAGE MagicHash #-}" ] where - eTagToDoc ∷ ETag → Doc - eTagToDoc = text ∘ convertSuccessVia ((⊥) ∷ Ascii) - - mimeTypeToDoc ∷ MIMEType → Doc - mimeTypeToDoc = text ∘ A.toString ∘ A.fromAsciiBuilder ∘ printMIMEType + toDoc ∷ ConvertSuccess α Ascii ⇒ α → Doc + toDoc = text ∘ convertSuccessVia ((⊥) ∷ Ascii) moduleDecl ∷ ModName → Name → Doc moduleDecl modName symName