Files
ghc-mod/Language/Haskell/GhcMod/Doc.hs

26 lines
841 B
Haskell
Raw Normal View History

2013-05-17 10:00:01 +09:00
module Language.Haskell.GhcMod.Doc where
2013-03-12 22:15:23 +09:00
import GHC
import Language.Haskell.GhcMod.Gap (withStyle, showDocWith)
import Outputable
import Pretty (Mode(..))
2013-03-12 22:15:23 +09:00
showPage :: DynFlags -> PprStyle -> SDoc -> String
showPage dflag style = showDocWith dflag PageMode . withStyle dflag style
2013-07-14 17:07:30 +09:00
showOneLine :: DynFlags -> PprStyle -> SDoc -> String
showOneLine dflag style = showDocWith dflag OneLineMode . withStyle dflag style
2013-07-14 17:07:30 +09:00
2015-03-05 16:50:06 +01:00
-- showForUser :: DynFlags -> PrintUnqualified -> SDoc -> String
-- showForUser dflags unqual sdoc =
-- showDocWith dflags PageMode $
-- runSDoc sdoc $ initSDocContext dflags $ mkUserStyle unqual AllTheWay
getStyle :: GhcMonad m => m PprStyle
getStyle = do
unqual <- getPrintUnqual
return $ mkUserStyle unqual AllTheWay
2013-03-12 22:15:23 +09:00
2013-07-14 17:07:30 +09:00
styleUnqualified :: PprStyle
styleUnqualified = mkUserStyle neverQualify AllTheWay