-- | Pretty-prints a 'Conf' to a 'Doc'
--
-- 'pPrint' restricted to 'Conf'
--
-- @
-- print (pPrintConf c)
-- @
--
-- Because of https://github.com/haskell/pretty/issues/26, it's not easy to
-- prevent trailing spaces while generating the output. This function patches
-- it at the end so there're no trailing spaces.
--
-- See "Text.PrettyPrint"
pPrintConf :: Conf -> Doc
pPrintConf c =
    let d = pPrint c
        ds = init (unlines (map stripEnd (lines (show d))))
    in text ds
  where
    stripEnd = reverse . dropWhile isSpace . reverse
pPrintConf :: Conf -> Doc
pPrintConf c =
    let d = pPrint c
        ds = init (unlines (map stripEnd (lines (show d))))
    in text ds
  where
    stripEnd = reverse . dropWhile isSpace . reverse
pPrintConf c =
    let d = pPrint c
        ds = init (unlines (map stripEnd (lines (show d))))
    in text ds
  where
    stripEnd = reverse . dropWhile isSpace . reverse