module Hhp.Doc where import GHC (Ghc, DynFlags, getPrintUnqual, pprCols) import Outputable (PprStyle, SDoc, withPprStyleDoc, neverQualify) import Pretty (Mode(..), Doc, Style(..), renderStyle, style) import Hhp.Gap (makeUserStyle) showPage :: DynFlags -> PprStyle -> SDoc -> String showPage :: DynFlags -> PprStyle -> SDoc -> String showPage DynFlags dflag PprStyle stl = DynFlags -> Mode -> Doc -> String showDocWith DynFlags dflag Mode PageMode (Doc -> String) -> (SDoc -> Doc) -> SDoc -> String forall b c a. (b -> c) -> (a -> b) -> a -> c . DynFlags -> PprStyle -> SDoc -> Doc withPprStyleDoc DynFlags dflag PprStyle stl showOneLine :: DynFlags -> PprStyle -> SDoc -> String showOneLine :: DynFlags -> PprStyle -> SDoc -> String showOneLine DynFlags dflag PprStyle stl = DynFlags -> Mode -> Doc -> String showDocWith DynFlags dflag Mode OneLineMode (Doc -> String) -> (SDoc -> Doc) -> SDoc -> String forall b c a. (b -> c) -> (a -> b) -> a -> c . DynFlags -> PprStyle -> SDoc -> Doc withPprStyleDoc DynFlags dflag PprStyle stl getStyle :: DynFlags -> Ghc PprStyle getStyle :: DynFlags -> Ghc PprStyle getStyle DynFlags dflags = DynFlags -> PrintUnqualified -> PprStyle makeUserStyle DynFlags dflags (PrintUnqualified -> PprStyle) -> Ghc PrintUnqualified -> Ghc PprStyle forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> Ghc PrintUnqualified forall (m :: * -> *). GhcMonad m => m PrintUnqualified getPrintUnqual styleUnqualified :: DynFlags -> PprStyle styleUnqualified :: DynFlags -> PprStyle styleUnqualified DynFlags dflags = DynFlags -> PrintUnqualified -> PprStyle makeUserStyle DynFlags dflags PrintUnqualified neverQualify showDocWith :: DynFlags -> Mode -> Doc -> String showDocWith :: DynFlags -> Mode -> Doc -> String showDocWith DynFlags dflags Mode md = Style -> Doc -> String renderStyle Style mstyle where mstyle :: Style mstyle = Style style { mode :: Mode mode = Mode md, lineLength :: Int lineLength = DynFlags -> Int pprCols DynFlags dflags }