ghc-mod/src/GHCMod/Options/DocUtils.hs

37 lines
665 B
Haskell
Raw Normal View History

2015-12-05 20:55:12 +00:00
module GHCMod.Options.DocUtils (
module PP,
desc,
2015-12-06 16:22:21 +00:00
code,
($$),
(##),
(<$$>),
(<||>)
2015-12-05 20:55:12 +00:00
) where
import Options.Applicative
2015-12-06 18:05:12 +00:00
import Data.Monoid (Monoid) -- for ghc<7.10
2015-12-06 16:22:21 +00:00
import Text.PrettyPrint.ANSI.Leijen as PP hiding ((<>), (<$>), (<$$>), int)
2015-12-05 20:55:12 +00:00
desc :: [Doc] -> InfoMod a
desc = footerDoc . Just . indent 2 . vsep
code :: [String] -> Doc
code x = vsep [line, indent 4 $ vsep $ map text x, line]
2015-12-06 16:22:21 +00:00
infixl 7 <||>
infixr 8 <$$>
infixr 8 $$
infixr 9 ##
($$) :: (a -> b) -> a -> b
($$) = ($)
(<||>) :: Alternative a => a b -> a b -> a b
(<||>) = (<|>)
(##) :: Monoid m => m -> m -> m
(##) = (<>)
(<$$>) :: Functor f => (a -> b) -> f a -> f b
(<$$>) = (<$>)