pretty-simple-1.1.0.3: pretty printer for data types with a 'Show' instance.

Copyright(c) Dennis Gosnell 2016
LicenseBSD-style (see LICENSE file)
Maintainercdep.illabout@gmail.com
Stabilityexperimental
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

Text.Pretty.Simple.Internal.OutputPrinter

Description

 

Synopsis

Documentation

data UseColor Source #

UseColor describes whether or not we want to use color when printing the Output list.

Constructors

NoColor 
UseColor 

Instances

Eq UseColor Source # 
Data UseColor Source # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> UseColor -> c UseColor #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c UseColor #

toConstr :: UseColor -> Constr #

dataTypeOf :: UseColor -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c UseColor) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UseColor) #

gmapT :: (forall b. Data b => b -> b) -> UseColor -> UseColor #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UseColor -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UseColor -> r #

gmapQ :: (forall d. Data d => d -> u) -> UseColor -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> UseColor -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> UseColor -> m UseColor #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> UseColor -> m UseColor #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> UseColor -> m UseColor #

Read UseColor Source # 
Show UseColor Source # 
Generic UseColor Source # 

Associated Types

type Rep UseColor :: * -> * #

Methods

from :: UseColor -> Rep UseColor x #

to :: Rep UseColor x -> UseColor #

type Rep UseColor Source # 
type Rep UseColor = D1 (MetaData "UseColor" "Text.Pretty.Simple.Internal.OutputPrinter" "pretty-simple-1.1.0.3-B6jAcPM6PosHG4NmKNNIEM" False) ((:+:) (C1 (MetaCons "NoColor" PrefixI False) U1) (C1 (MetaCons "UseColor" PrefixI False) U1))

data OutputOptions Source #

Data-type wrapping up all the options available when rendering the list of Outputs.

Constructors

OutputOptions 

Fields

Instances

Eq OutputOptions Source # 
Data OutputOptions Source # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> OutputOptions -> c OutputOptions #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c OutputOptions #

toConstr :: OutputOptions -> Constr #

dataTypeOf :: OutputOptions -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c OutputOptions) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c OutputOptions) #

gmapT :: (forall b. Data b => b -> b) -> OutputOptions -> OutputOptions #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> OutputOptions -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> OutputOptions -> r #

gmapQ :: (forall d. Data d => d -> u) -> OutputOptions -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> OutputOptions -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> OutputOptions -> m OutputOptions #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> OutputOptions -> m OutputOptions #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> OutputOptions -> m OutputOptions #

Read OutputOptions Source # 
Show OutputOptions Source # 
Generic OutputOptions Source # 

Associated Types

type Rep OutputOptions :: * -> * #

type Rep OutputOptions Source # 
type Rep OutputOptions = D1 (MetaData "OutputOptions" "Text.Pretty.Simple.Internal.OutputPrinter" "pretty-simple-1.1.0.3-B6jAcPM6PosHG4NmKNNIEM" False) (C1 (MetaCons "OutputOptions" PrefixI True) ((:*:) (S1 (MetaSel (Just Symbol "outputOptionsIndentAmount") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Int)) (S1 (MetaSel (Just Symbol "outputOptionsUseColor") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 UseColor))))

sequenceFold :: (Monad f, Monoid a, Traversable t) => t (f a) -> f a Source #

modificationsOutputList :: [Output] -> [Output] Source #

A function that performs optimizations and modifications to a list of input Outputs.

An sample of an optimization is removeStartingNewLine which just removes a newline if it is the first item in an Output list.

removeStartingNewLine :: [Output] -> [Output] Source #

Remove a OutputNewLine if it is the first item in the Output list.

>>> removeStartingNewLine [Output 3 OutputNewLine, Output 3 OutputComma]
[Output {outputNestLevel = NestLevel {unNestLevel = 3}, outputOutputType = OutputComma}]

compressOthers :: [Output] -> [Output] Source #

If there are two subsequent OutputOther tokens, combine them into just one OutputOther.

>>> compressOthers [Output 0 (OutputOther "foo"), Output 0 (OutputOther "bar")]
[Output {outputNestLevel = NestLevel {unNestLevel = 0}, outputOutputType = OutputOther "foobar"}]

shrinkWhitespaceInOthers :: [Output] -> [Output] Source #

In each OutputOther token, compress multiple whitespaces to just one whitespace.

>>> shrinkWhitespaceInOthers [Output 0 (OutputOther "  hello  ")]
[Output {outputNestLevel = NestLevel {unNestLevel = 0}, outputOutputType = OutputOther " hello "}]

ifM :: Monad m => m Bool -> a -> a -> m a Source #