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

Copyright | (c) Dennis Gosnell 2016
License | BSD-style (see LICENSE file)
Maintainer | cdep.illabout@gmail.com
Stability | experimental
Portability | POSIX
Safe Haskell | None
Language | Haskell2010

Text.Pretty.Simple.Internal.Output

Description

Synopsis

- newtype NestLevel = NestLevel {
  - unNestLevel :: Int
  }
- data OutputType
  - = OutputCloseBrace
  - | OutputCloseBracket
  - | OutputCloseParen
  - | OutputComma
  - | OutputIndent
  - | OutputNewLine
  - | OutputOpenBrace
  - | OutputOpenBracket
  - | OutputOpenParen
  - | OutputOther !String
  - | OutputStringLit !String
- data Output = Output {
  - outputNestLevel :: !NestLevel
  - outputOutputType :: !OutputType
  }

# Documentation

newtype NestLevel Source #

Datatype representing how much something is nested.

For example, a `NestLevel` of 0 would mean an `Output` token is at the very highest level, not in any braces.

A `NestLevel` of 1 would mean that an `Output` token is in one single pair of `{` and `}`, or `[` and `], or` \(@ and @\)@.

A `NestLevel` of 2 would mean that an `Output` token is two levels of brackets, etc.

Constructors

NestLevel |

Fields

- unNestLevel :: Int

Instances

Eq NestLevel Source # |
Instance details Defined in Text.Pretty.Simple.Internal.Output Methods (==) :: NestLevel -> NestLevel -> Bool Source # (/=) :: NestLevel -> NestLevel -> Bool Source #
Data NestLevel Source # |

Instance details

Defined in Text.Pretty.Simple.Internal.Output

Methods

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

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

toConstr :: NestLevel -> Constr Source #

dataTypeOf :: NestLevel -> DataType Source #

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

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

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

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

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

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

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

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

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

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

Num NestLevel Source # |
Instance details Defined in Text.Pretty.Simple.Internal.Output Methods (+) :: NestLevel -> NestLevel -> NestLevel Source # (-) :: NestLevel -> NestLevel -> NestLevel Source # (*) :: NestLevel -> NestLevel -> NestLevel Source # negate :: NestLevel -> NestLevel Source # abs :: NestLevel -> NestLevel Source # signum :: NestLevel -> NestLevel Source # fromInteger :: Integer -> NestLevel Source #
Ord NestLevel Source # |

Instance details

Defined in Text.Pretty.Simple.Internal.Output

Methods

compare :: NestLevel -> NestLevel -> Ordering Source #

(<) :: NestLevel -> NestLevel -> Bool Source #

(<=) :: NestLevel -> NestLevel -> Bool Source #

(>) :: NestLevel -> NestLevel -> Bool Source #

(>=) :: NestLevel -> NestLevel -> Bool Source #

max :: NestLevel -> NestLevel -> NestLevel Source #

min :: NestLevel -> NestLevel -> NestLevel Source #

Read NestLevel Source # |
Instance details Defined in Text.Pretty.Simple.Internal.Output Methods readsPrec :: Int -> ReadS NestLevel Source # readList :: ReadS [NestLevel] Source # readPrec :: ReadPrec NestLevel Source # readListPrec :: ReadPrec [NestLevel] Source #
Show NestLevel Source # |
Instance details Defined in Text.Pretty.Simple.Internal.Output Methods showsPrec :: Int -> NestLevel -> ShowS Source # show :: NestLevel -> String Source # showList :: [NestLevel] -> ShowS Source #
Generic NestLevel Source # |
Instance details Defined in Text.Pretty.Simple.Internal.Output Associated Types type Rep NestLevel :: Type -> Type Source # Methods from :: NestLevel -> Rep NestLevel x Source # to :: Rep NestLevel x -> NestLevel Source #
type Rep NestLevel Source # |
Instance details Defined in Text.Pretty.Simple.Internal.Output type Rep NestLevel = D1 (MetaData "NestLevel" "Text.Pretty.Simple.Internal.Output" "pretty-simple-2.2.0.1-8wtVJ8ANI1Y6MXsZeB7gq0" True) (C1 (MetaCons "NestLevel" PrefixI True) (S1 (MetaSel (Just "unNestLevel") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Int)))

data OutputType Source #

These are the output tokens that we will be printing to the screen.

Constructors

OutputCloseBrace | This represents the `}` character.
OutputCloseBracket | This represents the `]` character.
OutputCloseParen | This represents the `)` character.
OutputComma | This represents the `,` character.
OutputIndent | This represents an indentation.
OutputNewLine | This represents the `\n` character.
OutputOpenBrace | This represents the `{` character.
OutputOpenBracket | This represents the `[` character.
OutputOpenParen | This represents the `(` character.
OutputOther !String | This represents some collection of characters that don't fit into any of the other tokens.
OutputStringLit !String | This represents a string literal. For instance, `"foobar"`.

Instances

Eq OutputType Source # |
Instance details Defined in Text.Pretty.Simple.Internal.Output Methods (==) :: OutputType -> OutputType -> Bool Source # (/=) :: OutputType -> OutputType -> Bool Source #
Data OutputType Source # |

Instance details

Defined in Text.Pretty.Simple.Internal.Output

Methods

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

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

toConstr :: OutputType -> Constr Source #

dataTypeOf :: OutputType -> DataType Source #

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

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

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

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

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

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

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

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

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

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

Read OutputType Source # |
Instance details Defined in Text.Pretty.Simple.Internal.Output Methods readsPrec :: Int -> ReadS OutputType Source # readList :: ReadS [OutputType] Source # readPrec :: ReadPrec OutputType Source # readListPrec :: ReadPrec [OutputType] Source #
Show OutputType Source # |
Instance details Defined in Text.Pretty.Simple.Internal.Output Methods showsPrec :: Int -> OutputType -> ShowS Source # show :: OutputType -> String Source # showList :: [OutputType] -> ShowS Source #
IsString OutputType Source # | `IsString` (and `fromString`) should generally only be used in tests and debugging. There is no way to represent `OutputIndent` and `OutputStringLit`.
Instance details Defined in Text.Pretty.Simple.Internal.Output Methods fromString :: String -> OutputType Source #
Generic OutputType Source # |
Instance details Defined in Text.Pretty.Simple.Internal.Output Associated Types type Rep OutputType :: Type -> Type Source # Methods from :: OutputType -> Rep OutputType x Source # to :: Rep OutputType x -> OutputType Source #
type Rep OutputType Source # |

Instance details

Defined in Text.Pretty.Simple.Internal.Output

type Rep OutputType = D1 (MetaData "OutputType" "Text.Pretty.Simple.Internal.Output" "pretty-simple-2.2.0.1-8wtVJ8ANI1Y6MXsZeB7gq0" False) (((C1 (MetaCons "OutputCloseBrace" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "OutputCloseBracket" PrefixI False) (U1 :: Type -> Type)) :+: (C1 (MetaCons "OutputCloseParen" PrefixI False) (U1 :: Type -> Type) :+: (C1 (MetaCons "OutputComma" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "OutputIndent" PrefixI False) (U1 :: Type -> Type)))) :+: ((C1 (MetaCons "OutputNewLine" PrefixI False) (U1 :: Type -> Type) :+: (C1 (MetaCons "OutputOpenBrace" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "OutputOpenBracket" PrefixI False) (U1 :: Type -> Type))) :+: (C1 (MetaCons "OutputOpenParen" PrefixI False) (U1 :: Type -> Type) :+: (C1 (MetaCons "OutputOther" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 String)) :+: C1 (MetaCons "OutputStringLit" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 String))))))

data Output Source #

An `OutputType` token together with a `NestLevel`. Basically, each `OutputType` keeps track of its own `NestLevel`.

Constructors

Output |

Fields

- outputNestLevel :: !NestLevel
- outputOutputType :: !OutputType

Instances

Eq Output Source # |
Instance details Defined in Text.Pretty.Simple.Internal.Output Methods (==) :: Output -> Output -> Bool Source # (/=) :: Output -> Output -> Bool Source #
Data Output Source # |

Instance details

Defined in Text.Pretty.Simple.Internal.Output

Methods

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

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

toConstr :: Output -> Constr Source #

dataTypeOf :: Output -> DataType Source #

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

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

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

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

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

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

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

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

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

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

Read Output Source # |
Instance details Defined in Text.Pretty.Simple.Internal.Output Methods readsPrec :: Int -> ReadS Output Source # readList :: ReadS [Output] Source # readPrec :: ReadPrec Output Source # readListPrec :: ReadPrec [Output] Source #
Show Output Source # |
Instance details Defined in Text.Pretty.Simple.Internal.Output Methods showsPrec :: Int -> Output -> ShowS Source # show :: Output -> String Source # showList :: [Output] -> ShowS Source #
Generic Output Source # |
Instance details Defined in Text.Pretty.Simple.Internal.Output Associated Types type Rep Output :: Type -> Type Source # Methods from :: Output -> Rep Output x Source # to :: Rep Output x -> Output Source #
type Rep Output Source # |

Instance details

Defined in Text.Pretty.Simple.Internal.Output

type Rep Output = D1 (MetaData "Output" "Text.Pretty.Simple.Internal.Output" "pretty-simple-2.2.0.1-8wtVJ8ANI1Y6MXsZeB7gq0" False) (C1 (MetaCons "Output" PrefixI True) (S1 (MetaSel (Just "outputNestLevel") SourceUnpack SourceStrict DecidedStrict) (Rec0 NestLevel) :*: S1 (MetaSel (Just "outputOutputType") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 OutputType)))