X-Git-Url: http://git.cielonegro.org/gitweb.cgi?p=Lucu.git;a=blobdiff_plain;f=Network%2FHTTP%2FLucu%2FImplant%2FPrettyPrint.hs;fp=Network%2FHTTP%2FLucu%2FImplant%2FPrettyPrint.hs;h=22e3a74538c3a3342a74979c45d60382a3742c63;hp=f5376f1267631f0aa82faf378c5fb52069d0d975;hb=5f2ef377345fc47aabc63c1325df82c1cd9da9ed;hpb=313924e79d4ed48d3efb9f2530a48305fdd68c4b diff --git a/Network/HTTP/Lucu/Implant/PrettyPrint.hs b/Network/HTTP/Lucu/Implant/PrettyPrint.hs index f5376f1..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 @@ -14,11 +16,12 @@ module Network.HTTP.Lucu.Implant.PrettyPrint where import Codec.Compression.GZip import Control.Monad -import Data.Ascii (CIAscii) -import qualified Data.Ascii as A +import Data.Ascii (Ascii, CIAscii) 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 import Data.Ratio @@ -59,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 ∘ A.toString ∘ A.fromAsciiBuilder ∘ printETag - - 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