    {-# LANGUAGE CPP #-}
    {-# LANGUAGE DeriveDataTypeable #-}
    {-# LANGUAGE DeriveGeneric #-}
    {-# LANGUAGE FlexibleContexts #-}
    {-# LANGUAGE GeneralizedNewtypeDeriving #-}
    {-# LANGUAGE InstanceSigs #-}
    {-# LANGUAGE RankNTypes #-}
    {-# LANGUAGE ScopedTypeVariables #-}
    {-# LANGUAGE TemplateHaskell #-}
    {-# LANGUAGE TypeFamilies #-}

    {-|
    Module      : Text.Pretty.Simple.Internal.Output
    Copyright   : (c) Dennis Gosnell, 2016
    License     : BSD-style (see LICENSE file)
    Maintainer  : cdep.illabout@gmail.com
    Stability   : experimental
    Portability : POSIX

    -}
    module Text.Pretty.Simple.Internal.Output
      where

    #if __GLASGOW_HASKELL__ < 710
    -- We don't need this import for GHC 7.10 as it exports all required functions
    -- from Prelude
    import Control.Applicative
    #endif

    import Data.Data (Data)
    import Data.String (IsString, fromString)
    import Data.Typeable (Typeable)
    import GHC.Generics (Generic)

    -- | 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.
    newtype NestLevel = NestLevel { NestLevel -> Int
    unNestLevel :: Int }
      deriving (Typeable NestLevel
    Constr
    DataType
    Typeable NestLevel =>
    (forall (c :: * -> *).
     (forall d b. Data d => c (d -> b) -> d -> c b)
     -> (forall g. g -> c g) -> NestLevel -> c NestLevel)
    -> (forall (c :: * -> *).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c NestLevel)
    -> (NestLevel -> Constr)
    -> (NestLevel -> DataType)
    -> (forall (t :: * -> *) (c :: * -> *).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c NestLevel))
    -> (forall (t :: * -> * -> *) (c :: * -> *).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c NestLevel))
    -> ((forall b. Data b => b -> b) -> NestLevel -> NestLevel)
    -> (forall r r'.
        (r -> r' -> r)
        -> r -> (forall d. Data d => d -> r') -> NestLevel -> r)
    -> (forall r r'.
        (r' -> r -> r)
        -> r -> (forall d. Data d => d -> r') -> NestLevel -> r)
    -> (forall u. (forall d. Data d => d -> u) -> NestLevel -> [u])
    -> (forall u.
        Int -> (forall d. Data d => d -> u) -> NestLevel -> u)
    -> (forall (m :: * -> *).
        Monad m =>
        (forall d. Data d => d -> m d) -> NestLevel -> m NestLevel)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> NestLevel -> m NestLevel)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> NestLevel -> m NestLevel)
    -> Data NestLevel
    NestLevel -> Constr
    NestLevel -> DataType
    (forall b. Data b => b -> b) -> NestLevel -> NestLevel
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> NestLevel -> c NestLevel
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c NestLevel
    forall a.
    Typeable a =>
    (forall (c :: * -> *).
     (forall d b. Data d => c (d -> b) -> d -> c b)
     -> (forall g. g -> c g) -> a -> c a)
    -> (forall (c :: * -> *).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c a)
    -> (a -> Constr)
    -> (a -> DataType)
    -> (forall (t :: * -> *) (c :: * -> *).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c a))
    -> (forall (t :: * -> * -> *) (c :: * -> *).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
    -> ((forall b. Data b => b -> b) -> a -> a)
    -> (forall r r'.
        (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
    -> (forall r r'.
        (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
    -> (forall u. (forall d. Data d => d -> u) -> a -> [u])
    -> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
    -> (forall (m :: * -> *).
        Monad m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> Data a
    forall u. Int -> (forall d. Data d => d -> u) -> NestLevel -> u
    forall u. (forall d. Data d => d -> u) -> NestLevel -> [u]
    forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> NestLevel -> r
    forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> NestLevel -> r
    forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> NestLevel -> m NestLevel
    forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> NestLevel -> m NestLevel
    forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c NestLevel
    forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> NestLevel -> c NestLevel
    forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c NestLevel)
    forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c NestLevel)
    $cNestLevel :: Constr
    $tNestLevel :: DataType
    gmapMo :: (forall d. Data d => d -> m d) -> NestLevel -> m NestLevel
    $cgmapMo :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> NestLevel -> m NestLevel
    gmapMp :: (forall d. Data d => d -> m d) -> NestLevel -> m NestLevel
    $cgmapMp :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> NestLevel -> m NestLevel
    gmapM :: (forall d. Data d => d -> m d) -> NestLevel -> m NestLevel
    $cgmapM :: forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> NestLevel -> m NestLevel
    gmapQi :: Int -> (forall d. Data d => d -> u) -> NestLevel -> u
    $cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> NestLevel -> u
    gmapQ :: (forall d. Data d => d -> u) -> NestLevel -> [u]
    $cgmapQ :: forall u. (forall d. Data d => d -> u) -> NestLevel -> [u]
    gmapQr :: (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> NestLevel -> r
    $cgmapQr :: forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> NestLevel -> r
    gmapQl :: (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> NestLevel -> r
    $cgmapQl :: forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> NestLevel -> r
    gmapT :: (forall b. Data b => b -> b) -> NestLevel -> NestLevel
    $cgmapT :: (forall b. Data b => b -> b) -> NestLevel -> NestLevel
    dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c NestLevel)
    $cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c NestLevel)
    dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c NestLevel)
    $cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c NestLevel)
    dataTypeOf :: NestLevel -> DataType
    $cdataTypeOf :: NestLevel -> DataType
    toConstr :: NestLevel -> Constr
    $ctoConstr :: NestLevel -> Constr
    gunfold :: (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c NestLevel
    $cgunfold :: forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c NestLevel
    gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> NestLevel -> c NestLevel
    $cgfoldl :: forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> NestLevel -> c NestLevel
    $cp1Data :: Typeable NestLevel
    Data, NestLevel -> NestLevel -> Bool
    (NestLevel -> NestLevel -> Bool)
    -> (NestLevel -> NestLevel -> Bool) -> Eq NestLevel
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    /= :: NestLevel -> NestLevel -> Bool
    $c/= :: NestLevel -> NestLevel -> Bool
    == :: NestLevel -> NestLevel -> Bool
    $c== :: NestLevel -> NestLevel -> Bool
    Eq, (forall x. NestLevel -> Rep NestLevel x)
    -> (forall x. Rep NestLevel x -> NestLevel) -> Generic NestLevel
    forall x. Rep NestLevel x -> NestLevel
    forall x. NestLevel -> Rep NestLevel x
    forall a.
    (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
    $cto :: forall x. Rep NestLevel x -> NestLevel
    $cfrom :: forall x. NestLevel -> Rep NestLevel x
    Generic, Integer -> NestLevel
    NestLevel -> NestLevel
    NestLevel -> NestLevel -> NestLevel
    (NestLevel -> NestLevel -> NestLevel)
    -> (NestLevel -> NestLevel -> NestLevel)
    -> (NestLevel -> NestLevel -> NestLevel)
    -> (NestLevel -> NestLevel)
    -> (NestLevel -> NestLevel)
    -> (NestLevel -> NestLevel)
    -> (Integer -> NestLevel)
    -> Num NestLevel
    forall a.
    (a -> a -> a)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> (a -> a)
    -> (a -> a)
    -> (a -> a)
    -> (Integer -> a)
    -> Num a
    fromInteger :: Integer -> NestLevel
    $cfromInteger :: Integer -> NestLevel
    signum :: NestLevel -> NestLevel
    $csignum :: NestLevel -> NestLevel
    abs :: NestLevel -> NestLevel
    $cabs :: NestLevel -> NestLevel
    negate :: NestLevel -> NestLevel
    $cnegate :: NestLevel -> NestLevel
    * :: NestLevel -> NestLevel -> NestLevel
    $c* :: NestLevel -> NestLevel -> NestLevel
    - :: NestLevel -> NestLevel -> NestLevel
    $c- :: NestLevel -> NestLevel -> NestLevel
    + :: NestLevel -> NestLevel -> NestLevel
    $c+ :: NestLevel -> NestLevel -> NestLevel
    Num, Eq NestLevel
    Eq NestLevel =>
    (NestLevel -> NestLevel -> Ordering)
    -> (NestLevel -> NestLevel -> Bool)
    -> (NestLevel -> NestLevel -> Bool)
    -> (NestLevel -> NestLevel -> Bool)
    -> (NestLevel -> NestLevel -> Bool)
    -> (NestLevel -> NestLevel -> NestLevel)
    -> (NestLevel -> NestLevel -> NestLevel)
    -> Ord NestLevel
    NestLevel -> NestLevel -> Bool
    NestLevel -> NestLevel -> Ordering
    NestLevel -> NestLevel -> NestLevel
    forall a.
    Eq a =>
    (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    min :: NestLevel -> NestLevel -> NestLevel
    $cmin :: NestLevel -> NestLevel -> NestLevel
    max :: NestLevel -> NestLevel -> NestLevel
    $cmax :: NestLevel -> NestLevel -> NestLevel
    >= :: NestLevel -> NestLevel -> Bool
    $c>= :: NestLevel -> NestLevel -> Bool
    > :: NestLevel -> NestLevel -> Bool
    $c> :: NestLevel -> NestLevel -> Bool
    <= :: NestLevel -> NestLevel -> Bool
    $c<= :: NestLevel -> NestLevel -> Bool
    < :: NestLevel -> NestLevel -> Bool
    $c< :: NestLevel -> NestLevel -> Bool
    compare :: NestLevel -> NestLevel -> Ordering
    $ccompare :: NestLevel -> NestLevel -> Ordering
    $cp1Ord :: Eq NestLevel
    Ord, ReadPrec [NestLevel]
    ReadPrec NestLevel
    Int -> ReadS NestLevel
    ReadS [NestLevel]
    (Int -> ReadS NestLevel)
    -> ReadS [NestLevel]
    -> ReadPrec NestLevel
    -> ReadPrec [NestLevel]
    -> Read NestLevel
    forall a.
    (Int -> ReadS a)
    -> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
    readListPrec :: ReadPrec [NestLevel]
    $creadListPrec :: ReadPrec [NestLevel]
    readPrec :: ReadPrec NestLevel
    $creadPrec :: ReadPrec NestLevel
    readList :: ReadS [NestLevel]
    $creadList :: ReadS [NestLevel]
    readsPrec :: Int -> ReadS NestLevel
    $creadsPrec :: Int -> ReadS NestLevel
    Read, Int -> NestLevel -> ShowS
    [NestLevel] -> ShowS
    NestLevel -> String
    (Int -> NestLevel -> ShowS)
    -> (NestLevel -> String)
    -> ([NestLevel] -> ShowS)
    -> Show NestLevel
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    showList :: [NestLevel] -> ShowS
    $cshowList :: [NestLevel] -> ShowS
    show :: NestLevel -> String
    $cshow :: NestLevel -> String
    showsPrec :: Int -> NestLevel -> ShowS
    $cshowsPrec :: Int -> NestLevel -> ShowS
    Show, Typeable)

    -- | These are the output tokens that we will be printing to the screen.
    data OutputType
      = 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\"@.
      | OutputCharLit !String
      -- ^ This represents a char literal.  For example, @'x'@ or @'\b'@
      | OutputNumberLit !String
      -- ^ This represents a numeric literal.  For example, @12345@ or @3.14159@.
      deriving (Typeable OutputType
    Constr
    DataType
    Typeable OutputType =>
    (forall (c :: * -> *).
     (forall d b. Data d => c (d -> b) -> d -> c b)
     -> (forall g. g -> c g) -> OutputType -> c OutputType)
    -> (forall (c :: * -> *).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c OutputType)
    -> (OutputType -> Constr)
    -> (OutputType -> DataType)
    -> (forall (t :: * -> *) (c :: * -> *).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c OutputType))
    -> (forall (t :: * -> * -> *) (c :: * -> *).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e))
        -> Maybe (c OutputType))
    -> ((forall b. Data b => b -> b) -> OutputType -> OutputType)
    -> (forall r r'.
        (r -> r' -> r)
        -> r -> (forall d. Data d => d -> r') -> OutputType -> r)
    -> (forall r r'.
        (r' -> r -> r)
        -> r -> (forall d. Data d => d -> r') -> OutputType -> r)
    -> (forall u. (forall d. Data d => d -> u) -> OutputType -> [u])
    -> (forall u.
        Int -> (forall d. Data d => d -> u) -> OutputType -> u)
    -> (forall (m :: * -> *).
        Monad m =>
        (forall d. Data d => d -> m d) -> OutputType -> m OutputType)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> OutputType -> m OutputType)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> OutputType -> m OutputType)
    -> Data OutputType
    OutputType -> Constr
    OutputType -> DataType
    (forall b. Data b => b -> b) -> OutputType -> OutputType
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> OutputType -> c OutputType
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c OutputType
    forall a.
    Typeable a =>
    (forall (c :: * -> *).
     (forall d b. Data d => c (d -> b) -> d -> c b)
     -> (forall g. g -> c g) -> a -> c a)
    -> (forall (c :: * -> *).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c a)
    -> (a -> Constr)
    -> (a -> DataType)
    -> (forall (t :: * -> *) (c :: * -> *).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c a))
    -> (forall (t :: * -> * -> *) (c :: * -> *).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
    -> ((forall b. Data b => b -> b) -> a -> a)
    -> (forall r r'.
        (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
    -> (forall r r'.
        (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
    -> (forall u. (forall d. Data d => d -> u) -> a -> [u])
    -> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
    -> (forall (m :: * -> *).
        Monad m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> Data a
    forall u. Int -> (forall d. Data d => d -> u) -> OutputType -> u
    forall u. (forall d. Data d => d -> u) -> OutputType -> [u]
    forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> OutputType -> r
    forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> OutputType -> r
    forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> OutputType -> m OutputType
    forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> OutputType -> m OutputType
    forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c OutputType
    forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> OutputType -> c OutputType
    forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c OutputType)
    forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c OutputType)
    $cOutputNumberLit :: Constr
    $cOutputCharLit :: Constr
    $cOutputStringLit :: Constr
    $cOutputOther :: Constr
    $cOutputOpenParen :: Constr
    $cOutputOpenBracket :: Constr
    $cOutputOpenBrace :: Constr
    $cOutputNewLine :: Constr
    $cOutputIndent :: Constr
    $cOutputComma :: Constr
    $cOutputCloseParen :: Constr
    $cOutputCloseBracket :: Constr
    $cOutputCloseBrace :: Constr
    $tOutputType :: DataType
    gmapMo :: (forall d. Data d => d -> m d) -> OutputType -> m OutputType
    $cgmapMo :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> OutputType -> m OutputType
    gmapMp :: (forall d. Data d => d -> m d) -> OutputType -> m OutputType
    $cgmapMp :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> OutputType -> m OutputType
    gmapM :: (forall d. Data d => d -> m d) -> OutputType -> m OutputType
    $cgmapM :: forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> OutputType -> m OutputType
    gmapQi :: Int -> (forall d. Data d => d -> u) -> OutputType -> u
    $cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> OutputType -> u
    gmapQ :: (forall d. Data d => d -> u) -> OutputType -> [u]
    $cgmapQ :: forall u. (forall d. Data d => d -> u) -> OutputType -> [u]
    gmapQr :: (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> OutputType -> r
    $cgmapQr :: forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> OutputType -> r
    gmapQl :: (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> OutputType -> r
    $cgmapQl :: forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> OutputType -> r
    gmapT :: (forall b. Data b => b -> b) -> OutputType -> OutputType
    $cgmapT :: (forall b. Data b => b -> b) -> OutputType -> OutputType
    dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c OutputType)
    $cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c OutputType)
    dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c OutputType)
    $cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c OutputType)
    dataTypeOf :: OutputType -> DataType
    $cdataTypeOf :: OutputType -> DataType
    toConstr :: OutputType -> Constr
    $ctoConstr :: OutputType -> Constr
    gunfold :: (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c OutputType
    $cgunfold :: forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c OutputType
    gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> OutputType -> c OutputType
    $cgfoldl :: forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> OutputType -> c OutputType
    $cp1Data :: Typeable OutputType
    Data, OutputType -> OutputType -> Bool
    (OutputType -> OutputType -> Bool)
    -> (OutputType -> OutputType -> Bool) -> Eq OutputType
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    /= :: OutputType -> OutputType -> Bool
    $c/= :: OutputType -> OutputType -> Bool
    == :: OutputType -> OutputType -> Bool
    $c== :: OutputType -> OutputType -> Bool
    Eq, (forall x. OutputType -> Rep OutputType x)
    -> (forall x. Rep OutputType x -> OutputType) -> Generic OutputType
    forall x. Rep OutputType x -> OutputType
    forall x. OutputType -> Rep OutputType x
    forall a.
    (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
    $cto :: forall x. Rep OutputType x -> OutputType
    $cfrom :: forall x. OutputType -> Rep OutputType x
    Generic, ReadPrec [OutputType]
    ReadPrec OutputType
    Int -> ReadS OutputType
    ReadS [OutputType]
    (Int -> ReadS OutputType)
    -> ReadS [OutputType]
    -> ReadPrec OutputType
    -> ReadPrec [OutputType]
    -> Read OutputType
    forall a.
    (Int -> ReadS a)
    -> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
    readListPrec :: ReadPrec [OutputType]
    $creadListPrec :: ReadPrec [OutputType]
    readPrec :: ReadPrec OutputType
    $creadPrec :: ReadPrec OutputType
    readList :: ReadS [OutputType]
    $creadList :: ReadS [OutputType]
    readsPrec :: Int -> ReadS OutputType
    $creadsPrec :: Int -> ReadS OutputType
    Read, Int -> OutputType -> ShowS
    [OutputType] -> ShowS
    OutputType -> String
    (Int -> OutputType -> ShowS)
    -> (OutputType -> String)
    -> ([OutputType] -> ShowS)
    -> Show OutputType
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    showList :: [OutputType] -> ShowS
    $cshowList :: [OutputType] -> ShowS
    show :: OutputType -> String
    $cshow :: OutputType -> String
    showsPrec :: Int -> OutputType -> ShowS
    $cshowsPrec :: Int -> OutputType -> ShowS
    Show, Typeable)

    -- | 'IsString' (and 'fromString') should generally only be used in tests and
    -- debugging.  There is no way to represent 'OutputIndent', 'OutputNumberLit'
    -- and 'OutputStringLit'.
    instance IsString OutputType where
        fromString :: String -> OutputType
        fromString :: String -> OutputType
    fromString "}" = OutputType
    OutputCloseBrace
        fromString "]" = OutputType
    OutputCloseBracket
        fromString ")" = OutputType
    OutputCloseParen
        fromString "," = OutputType
    OutputComma
        fromString "\n" = OutputType
    OutputNewLine
        fromString "{" = OutputType
    OutputOpenBrace
        fromString "[" = OutputType
    OutputOpenBracket
        fromString "(" = OutputType
    OutputOpenParen
        fromString string :: String
    string = String -> OutputType
    OutputOther String
    string

    -- | An 'OutputType' token together with a 'NestLevel'.  Basically, each
    -- 'OutputType' keeps track of its own 'NestLevel'.
    data Output = Output
      { Output -> NestLevel
    outputNestLevel :: {-# UNPACK #-} !NestLevel
      , Output -> OutputType
    outputOutputType :: !OutputType
      } deriving (Typeable Output
    Constr
    DataType
    Typeable Output =>
    (forall (c :: * -> *).
     (forall d b. Data d => c (d -> b) -> d -> c b)
     -> (forall g. g -> c g) -> Output -> c Output)
    -> (forall (c :: * -> *).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c Output)
    -> (Output -> Constr)
    -> (Output -> DataType)
    -> (forall (t :: * -> *) (c :: * -> *).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c Output))
    -> (forall (t :: * -> * -> *) (c :: * -> *).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Output))
    -> ((forall b. Data b => b -> b) -> Output -> Output)
    -> (forall r r'.
        (r -> r' -> r)
        -> r -> (forall d. Data d => d -> r') -> Output -> r)
    -> (forall r r'.
        (r' -> r -> r)
        -> r -> (forall d. Data d => d -> r') -> Output -> r)
    -> (forall u. (forall d. Data d => d -> u) -> Output -> [u])
    -> (forall u. Int -> (forall d. Data d => d -> u) -> Output -> u)
    -> (forall (m :: * -> *).
        Monad m =>
        (forall d. Data d => d -> m d) -> Output -> m Output)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> Output -> m Output)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> Output -> m Output)
    -> Data Output
    Output -> Constr
    Output -> DataType
    (forall b. Data b => b -> b) -> Output -> Output
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Output -> c Output
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Output
    forall a.
    Typeable a =>
    (forall (c :: * -> *).
     (forall d b. Data d => c (d -> b) -> d -> c b)
     -> (forall g. g -> c g) -> a -> c a)
    -> (forall (c :: * -> *).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c a)
    -> (a -> Constr)
    -> (a -> DataType)
    -> (forall (t :: * -> *) (c :: * -> *).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c a))
    -> (forall (t :: * -> * -> *) (c :: * -> *).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
    -> ((forall b. Data b => b -> b) -> a -> a)
    -> (forall r r'.
        (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
    -> (forall r r'.
        (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
    -> (forall u. (forall d. Data d => d -> u) -> a -> [u])
    -> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
    -> (forall (m :: * -> *).
        Monad m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> Data a
    forall u. Int -> (forall d. Data d => d -> u) -> Output -> u
    forall u. (forall d. Data d => d -> u) -> Output -> [u]
    forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Output -> r
    forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Output -> r
    forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Output -> m Output
    forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Output -> m Output
    forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Output
    forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Output -> c Output
    forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c Output)
    forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Output)
    $cOutput :: Constr
    $tOutput :: DataType
    gmapMo :: (forall d. Data d => d -> m d) -> Output -> m Output
    $cgmapMo :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Output -> m Output
    gmapMp :: (forall d. Data d => d -> m d) -> Output -> m Output
    $cgmapMp :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Output -> m Output
    gmapM :: (forall d. Data d => d -> m d) -> Output -> m Output
    $cgmapM :: forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Output -> m Output
    gmapQi :: Int -> (forall d. Data d => d -> u) -> Output -> u
    $cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Output -> u
    gmapQ :: (forall d. Data d => d -> u) -> Output -> [u]
    $cgmapQ :: forall u. (forall d. Data d => d -> u) -> Output -> [u]
    gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Output -> r
    $cgmapQr :: forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Output -> r
    gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Output -> r
    $cgmapQl :: forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Output -> r
    gmapT :: (forall b. Data b => b -> b) -> Output -> Output
    $cgmapT :: (forall b. Data b => b -> b) -> Output -> Output
    dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Output)
    $cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Output)
    dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c Output)
    $cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c Output)
    dataTypeOf :: Output -> DataType
    $cdataTypeOf :: Output -> DataType
    toConstr :: Output -> Constr
    $ctoConstr :: Output -> Constr
    gunfold :: (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Output
    $cgunfold :: forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Output
    gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Output -> c Output
    $cgfoldl :: forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Output -> c Output
    $cp1Data :: Typeable Output
    Data, Output -> Output -> Bool
    (Output -> Output -> Bool)
    -> (Output -> Output -> Bool) -> Eq Output
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    /= :: Output -> Output -> Bool
    $c/= :: Output -> Output -> Bool
    == :: Output -> Output -> Bool
    $c== :: Output -> Output -> Bool
    Eq, (forall x. Output -> Rep Output x)
    -> (forall x. Rep Output x -> Output) -> Generic Output
    forall x. Rep Output x -> Output
    forall x. Output -> Rep Output x
    forall a.
    (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
    $cto :: forall x. Rep Output x -> Output
    $cfrom :: forall x. Output -> Rep Output x
    Generic, ReadPrec [Output]
    ReadPrec Output
    Int -> ReadS Output
    ReadS [Output]
    (Int -> ReadS Output)
    -> ReadS [Output]
    -> ReadPrec Output
    -> ReadPrec [Output]
    -> Read Output
    forall a.
    (Int -> ReadS a)
    -> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
    readListPrec :: ReadPrec [Output]
    $creadListPrec :: ReadPrec [Output]
    readPrec :: ReadPrec Output
    $creadPrec :: ReadPrec Output
    readList :: ReadS [Output]
    $creadList :: ReadS [Output]
    readsPrec :: Int -> ReadS Output
    $creadsPrec :: Int -> ReadS Output
    Read, Int -> Output -> ShowS
    [Output] -> ShowS
    Output -> String
    (Int -> Output -> ShowS)
    -> (Output -> String) -> ([Output] -> ShowS) -> Show Output
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    showList :: [Output] -> ShowS
    $cshowList :: [Output] -> ShowS
    show :: Output -> String
    $cshow :: Output -> String
    showsPrec :: Int -> Output -> ShowS
    $cshowsPrec :: Int -> Output -> ShowS
    Show, Typeable)