-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | A Haskell pre-processor
--   
--   See the README for usage examples
@package hpp
@version 0.5.2


-- | Preprocessor Configuration
module Hpp.Config

-- | A <a>String</a> representing a time.
newtype TimeString
TimeString :: String -> TimeString
[getTimeString] :: TimeString -> String

-- | A <a>String</a> representing a date.
newtype DateString
DateString :: String -> DateString
[getDateString] :: DateString -> String

-- | Pre-processor configuration parameterized over a functor. This is used
--   to normalize partial configurations, <tt>ConfigF Maybe</tt>, and
--   configurations suitable for the pre-processor logic, <tt>ConfigF
--   Identity</tt>. Specifically, the source file name of the file being
--   processed <i>must</i> be set.
data ConfigF f
Config :: f FilePath -> f [FilePath] -> f Bool -> f Bool -> f Bool -> f Bool -> f DateString -> f TimeString -> ConfigF f

-- | Name of the file being preprocessed. Hpp will update this as new files
--   are included. The user must set it manually for the starting input
--   file.
[curFileNameF] :: ConfigF f -> f FilePath

-- | Paths to be searched for included files.
[includePathsF] :: ConfigF f -> f [FilePath]

-- | A backslash as the last character of a line causes the next line to be
--   appended to the current one eliding the newline character present in
--   the source input.
[spliceLongLinesF] :: ConfigF f -> f Bool

-- | Erase line comments (starting with <tt>//</tt>) and block comments
--   (delimited by <tt>/*</tt> and <tt>*/</tt>).
[eraseCCommentsF] :: ConfigF f -> f Bool

-- | Do not emit <tt>#line</tt> directives.
[inhibitLinemarkersF] :: ConfigF f -> f Bool

-- | Replace trigraph sequences (each of which starts with two consecutive
--   question marks (<tt>"??"</tt>) with the characters they encode.
[replaceTrigraphsF] :: ConfigF f -> f Bool

-- | Format string for <tt>__DATE__</tt>.
[prepDateF] :: ConfigF f -> f DateString

-- | Format string for <tt>__TIME__</tt>.
[prepTimeF] :: ConfigF f -> f TimeString

-- | A fully-populated configuration for the pre-processor.
type Config = ConfigF Identity

-- | Ensure that required configuration fields are supplied.
realizeConfig :: ConfigF Maybe -> Maybe Config

-- | Extract the current file name from a configuration.
curFileName :: Config -> FilePath

-- | Extract the include paths name from a configuration.
includePaths :: Config -> [FilePath]

-- | Determine if continued long lines should be spliced.
spliceLongLines :: Config -> Bool

-- | Determine if C-style comments should be erased.
eraseCComments :: Config -> Bool

-- | Determine if generation of linemarkers should be inhibited.
inhibitLinemarkers :: Config -> Bool

-- | Determine if trigraph sequences should be replaced.
replaceTrigraphs :: Config -> Bool

-- | The date the pre-processor was run on.
prepDate :: Config -> DateString

-- | The time of the active pre-processor invocation.
prepTime :: Config -> TimeString

-- | A default configuration with no current file name set. Note that long
--   line splicing is enabled, C++-style comments are erased, #line markers
--   are inhibited, and trigraph replacement is disabled.
defaultConfigF :: ConfigF Maybe

-- | Format a date according to the C spec.
formatPrepDate :: UTCTime -> DateString

-- | Format a time according to the C spec.
formatPrepTime :: UTCTime -> TimeString

-- | A default preprocessor configuration with date and time stamps taken
--   from the current system time.
defaultConfigFNow :: IO (ConfigF Maybe)
instance GHC.Show.Show Hpp.Config.DateString
instance GHC.Classes.Ord Hpp.Config.DateString
instance GHC.Classes.Eq Hpp.Config.DateString
instance GHC.Show.Show Hpp.Config.TimeString
instance GHC.Classes.Ord Hpp.Config.TimeString
instance GHC.Classes.Eq Hpp.Config.TimeString


-- | A name binding context, or environment.
module Hpp.Env
emptyEnv :: Trie a
insertPair :: (ByteString, a) -> Trie a -> Trie a
deleteKey :: ByteString -> Trie a -> Trie a
lookupKey :: ByteString -> Trie a -> Maybe a


-- | HELPERS for working with <a>String</a>s
module Hpp.String

-- | Stringification puts double quotes around a string and backslashes
--   before existing double quote characters and backslash characters.
stringify :: String -> String

-- | Remove double quote characters from the ends of a string.
unquote :: String -> String

-- | Trim trailing spaces from a <a>String</a>
trimSpaces :: String -> String

-- | Similar to the function of the same name in the <tt>text</tt> package.
--   
--   <tt>breakOn needles haystack</tt> finds the first instance of an
--   element of <tt>needles</tt> in <tt>haystack</tt>. The first component
--   of the result is the needle tag, the second component is the prefix of
--   <tt>haystack</tt> before the matched needle, the third component is
--   the remainder of the <tt>haystack</tt> <i>after</i> the needle..
breakOn :: [(String, t)] -> String -> Maybe (t, String, String)

-- | Used to make switching to the <tt>text</tt> package easier.
cons :: a -> [a] -> [a]

module Hpp.StringSig
data CharOrSub s
CharMatch :: !s -> !s -> CharOrSub s
SubMatch :: !s -> !s -> CharOrSub s
NoMatch :: CharOrSub s

-- | A collection of operations relating to sequences of characters.
class (IsString s, Monoid s) => Stringy s

-- | Stringification puts double quotes around a string and backslashes
--   before existing double quote characters and backslash characters.
stringify :: Stringy s => s -> s

-- | Remove double quote characters from the ends of a string.
unquote :: Stringy s => s -> s

-- | Trim trailing spaces from a <a>String</a>
trimSpaces :: Stringy s => s -> s

-- | Similar to the function of the same name in the <tt>text</tt> package.
--   
--   <tt>breakOn needles haystack</tt> finds the first instance of an
--   element of <tt>needles</tt> in <tt>haystack</tt>. The first component
--   of the result is the needle tag, the second component is the prefix of
--   <tt>haystack</tt> before the matched needle, the third component is
--   the remainder of the <tt>haystack</tt> <i>after</i> the needle..
breakOn :: Stringy s => [(s, t)] -> s -> Maybe (t, s, s)

-- | A special case of <a>breakOn</a> in which we are looking for either a
--   special character or a particular substring.
breakCharOrSub :: Stringy s => Char -> s -> s -> CharOrSub s
cons :: Stringy s => Char -> s -> s
uncons :: Stringy s => s -> Maybe (Char, s)
snoc :: Stringy s => s -> Char -> s
unsnoc :: Stringy s => s -> Maybe (s, Char)
sdrop :: Stringy s => Int -> s -> s
sbreak :: Stringy s => (Char -> Maybe t) -> s -> Maybe (t, s, s)
sall :: Stringy s => (Char -> Bool) -> s -> Bool
sIsPrefixOf :: Stringy s => s -> s -> Bool
isEmpty :: Stringy s => s -> Bool
readLines :: Stringy s => FilePath -> IO [s]
putStringy :: Stringy s => Handle -> s -> IO ()
toChars :: Stringy s => s -> [Char]

-- | An opportunity to copy a string to its own storage to help with GC
copy :: Stringy s => s -> s
boolJust :: Bool -> Maybe ()
predicateJust :: (a -> Bool) -> a -> Maybe a
sdropWhile :: Stringy s => (Char -> Bool) -> s -> s
infixr 5 :.
instance Hpp.StringSig.Stringy GHC.Base.String
instance Hpp.StringSig.Stringy Data.ByteString.Internal.ByteString


-- | Tokenization breaks a <a>String</a> into pieces of whitespace,
--   constants, symbols, and identifiers.
module Hpp.Tokens

-- | Tokenization is <a>words</a> except the white space is tagged rather
--   than discarded.
data Token s

-- | Identifiers, symbols, and constants
Important :: s -> Token s

-- | White space, etc.
Other :: s -> Token s

-- | Extract the contents of a <a>Token</a>.
detok :: Token s -> s

-- | <a>True</a> if the given <a>Token</a> is <a>Important</a>;
--   <a>False</a> otherwise.
isImportant :: Token s -> Bool

-- | <a>True</a> if the given <a>Token</a> is <i>not</i> <a>Important</a>;
--   <a>False</a> otherwise.
notImportant :: Token s -> Bool

-- | Return the contents of only <a>Important</a> (non-space) tokens.
importants :: [Token s] -> [s]

-- | Trim <a>Other</a> <a>Token</a>s from both ends of a list of
--   <a>Token</a>s.
trimUnimportant :: [Token s] -> [Token s]

-- | Collapse a sequence of <tt>Tokens</tt> back into a <a>String</a>.
--   <tt>detokenize . tokenize == id</tt>.
detokenize :: Monoid s => [Token s] -> s

-- | Break an input <a>String</a> into a sequence of <tt>Tokens</tt>.
--   Warning: This may not exactly correspond to your target language's
--   definition of a valid identifier!
tokenize :: Stringy s => s -> [Token s]

-- | Is a <a>Token</a> a newline character?
newLine :: (Eq s, IsString s) => Token s -> Bool
skipLiteral :: Stringy s => s -> (s, s)
instance GHC.Show.Show s => GHC.Show.Show (Hpp.Tokens.Token s)
instance GHC.Classes.Ord s => GHC.Classes.Ord (Hpp.Tokens.Token s)
instance GHC.Classes.Eq s => GHC.Classes.Eq (Hpp.Tokens.Token s)
instance GHC.Base.Functor Hpp.Tokens.Token


-- | An expression language corresponding to the subset of C syntax that
--   may be used in preprocessor conditional directives. See
--   <a>https://gcc.gnu.org/onlinedocs/cpp/If.html</a>
module Hpp.Expr

-- | Expressions are literal values, binary operators applied to two
--   sub-expressions, or unary operators applied to a single
--   sub-expression.
data Expr
ELit :: Lit -> Expr
EBinOp :: BinOp -> Expr -> Expr -> Expr
EUnaryOp :: UnaryOp -> Expr -> Expr

-- | Read a literal integer. These may be decimal, octal, or hexadecimal,
--   and may have a case-insensitive suffix of <tt>u</tt>, <tt>l</tt>, or
--   <tt>ul</tt>.
readLitInt :: String -> Maybe CppInt

-- | Try to read an <a>Expr</a> from a sequence of <a>Token</a>s.
parseExpr :: [Token String] -> Maybe Expr

-- | Pretty-print an <a>Expr</a> to something semantically equivalent to
--   the original C syntax (some parentheses may be added).
renderExpr :: Expr -> String

-- | All <a>Expr</a>s can be evaluated to an <a>Int</a>.
evalExpr :: Expr -> Int
instance GHC.Show.Show Hpp.Expr.Expr
instance GHC.Classes.Ord Hpp.Expr.Expr
instance GHC.Classes.Eq Hpp.Expr.Expr
instance GHC.Show.Show Hpp.Expr.FunLike
instance GHC.Classes.Ord Hpp.Expr.FunLike
instance GHC.Classes.Eq Hpp.Expr.FunLike
instance GHC.Show.Show Hpp.Expr.Assoc
instance GHC.Classes.Ord Hpp.Expr.Assoc
instance GHC.Classes.Eq Hpp.Expr.Assoc
instance GHC.Show.Show Hpp.Expr.Parsed
instance GHC.Classes.Ord Hpp.Expr.Parsed
instance GHC.Classes.Eq Hpp.Expr.Parsed
instance GHC.Show.Show Hpp.Expr.Lit
instance GHC.Classes.Ord Hpp.Expr.Lit
instance GHC.Classes.Eq Hpp.Expr.Lit
instance GHC.Show.Show Hpp.Expr.UnaryOp
instance GHC.Classes.Ord Hpp.Expr.UnaryOp
instance GHC.Classes.Eq Hpp.Expr.UnaryOp
instance GHC.Show.Show Hpp.Expr.BinOp
instance GHC.Classes.Ord Hpp.Expr.BinOp
instance GHC.Classes.Eq Hpp.Expr.BinOp
instance GHC.Classes.Eq Hpp.Expr.CppInt
instance GHC.Classes.Ord Hpp.Expr.CppInt
instance GHC.Num.Num Hpp.Expr.CppInt


-- | The core types involved used by the pre-processor.
module Hpp.Types

-- | Line numbers are represented as <a>Int</a>s
type LineNum = Int

-- | A macro binding environment.
type Env = Trie Macro
type String = ByteString
type TOKEN = Token ByteString

-- | Error conditions we may encounter.
data Error
UnterminatedBranch :: Error
BadMacroDefinition :: LineNum -> Error
BadIfPredicate :: Error
BadLineArgument :: LineNum -> String -> Error
IncludeDoesNotExist :: LineNum -> FilePath -> Error
FailedInclude :: LineNum -> FilePath -> Error
UserError :: LineNum -> String -> Error
UnknownCommand :: LineNum -> String -> Error
TooFewArgumentsToMacro :: LineNum -> String -> Error
BadMacroArguments :: LineNum -> String -> Error
NoInputFile :: Error
BadCommandLine :: String -> Error
RanOutOfInput :: Error

-- | Hpp can raise various parsing errors.
class HasError m
throwError :: HasError m => Error -> m a

-- | Base functor for a free monad transformer
data FreeF f a r
PureF :: a -> FreeF f a r
FreeF :: (f r) -> FreeF f a r

-- | Dynamic state of the preprocessor engine.
data HppState
HppState :: Config -> LineNum -> Env -> HppState

-- | Initial configuration
[hppConfig] :: HppState -> Config

-- | Current line number of input file
[hppLineNum] :: HppState -> LineNum

-- | Preprocessor binding environment
[hppEnv] :: HppState -> Env

-- | A free monad construction to strictly delimit what capabilities we
--   need to perform pre-processing.
data HppF t r
ReadFile :: Int -> FilePath -> (t -> r) -> HppF t r
ReadNext :: Int -> FilePath -> (t -> r) -> HppF t r
WriteOutput :: t -> r -> HppF t r

-- | A free monad transformer specialized to HppF as the base functor.
newtype HppT t m a
HppT :: m (FreeF (HppF t) a (HppT t m a)) -> HppT t m a
[runHppT] :: HppT t m a -> m (FreeF (HppF t) a (HppT t m a))
writeOutput :: Monad m => t -> HppT t m ()

-- | An interpreter capability to modify dynamic state.
class HasHppState m
getState :: HasHppState m => m HppState
setState :: HasHppState m => HppState -> m ()

-- | An interpreter capability of threading a binding environment.
class HasEnv m
getEnv :: HasEnv m => m Env
setEnv :: HasEnv m => Env -> m ()

-- | Macro expansion involves treating tokens differently if they appear in
--   the original source or as the result of a previous macro expansion.
--   This distinction is used to prevent divergence by masking out
--   definitions that could be used recursively.
--   
--   Things are made somewhat more complicated than one might expect due to
--   the fact that the scope of this masking is <i>not</i> structurally
--   recursive. A object-like macro can expand into a fragment of a macro
--   function application, one of whose arguments is a token matching the
--   original object-like macro. That argument should <i>not</i> be
--   expanded.
data Scan
Unmask :: String -> Scan
Mask :: String -> Scan
Scan :: (Token String) -> Scan
Rescan :: (Token String) -> Scan

-- | There are object-like macros and function-like macros.
data Macro

-- | An object-like macro is replaced with its definition
Object :: [Token String] -> Macro

-- | A function-like macro of some arity taks macro-expanded and raw
--   versions of its arguments, then substitutes them into a body producing
--   a new set of tokens.
Function :: Int -> ([([Scan], String)] -> [Scan]) -> Macro

-- | Looks up a <a>Macro</a> in the current environment. If the
--   <a>Macro</a> is found, the environment is juggled so that subsequent
--   lookups of the same <a>Macro</a> may evaluate more quickly.
lookupMacro :: (HasEnv m, Monad m) => String -> m (Maybe Macro)
type Lens s a = forall f. Functor f => (a -> f a) -> s -> f s
setL :: Lens s a -> a -> s -> s
getL :: Lens s a -> s -> a
over :: Lens s a -> (a -> a) -> s -> s
emptyHppState :: Config -> HppState
config :: Lens HppState Config
lineNum :: Lens HppState LineNum
env :: Lens HppState Env
use :: (HasHppState m, Functor m) => Lens HppState a -> m a
(.=) :: (HasHppState m, Monad m) => Lens HppState a -> a -> m ()
infix 4 .=
(%=) :: (HasHppState m, Monad m) => Lens HppState a -> (a -> a) -> m ()
infix 4 %=
instance GHC.Show.Show Hpp.Types.Scan
instance GHC.Classes.Eq Hpp.Types.Scan
instance GHC.Show.Show Hpp.Types.Error
instance GHC.Classes.Ord Hpp.Types.Error
instance GHC.Classes.Eq Hpp.Types.Error
instance (GHC.Base.Monad m, Hpp.Types.HasHppState m) => Hpp.Types.HasHppState (Control.Monad.Trans.Except.ExceptT e m)
instance GHC.Base.Monad m => Hpp.Types.HasHppState (Control.Monad.Trans.State.Strict.StateT Hpp.Types.HppState m)
instance (GHC.Base.Monad m, Hpp.Types.HasHppState m) => Hpp.Types.HasHppState (Control.Monad.Trans.State.Strict.StateT s m)
instance (GHC.Base.Monad m, Hpp.Types.HasHppState m) => Hpp.Types.HasHppState (Hpp.Types.HppT t m)
instance (GHC.Base.Monad m, Hpp.Types.HasHppState m) => Hpp.Types.HasEnv (Hpp.Types.HppT t m)
instance GHC.Base.Monad m => Hpp.Types.HasEnv (Control.Monad.Trans.State.Strict.StateT Hpp.Types.HppState m)
instance GHC.Base.Monad m => Hpp.Types.HasEnv (Control.Monad.Trans.State.Strict.StateT Hpp.Types.Env m)
instance (Hpp.Types.HasEnv m, GHC.Base.Monad m) => Hpp.Types.HasEnv (Control.Monad.Trans.Except.ExceptT e m)
instance GHC.Show.Show Hpp.Types.Macro
instance (GHC.Base.Monad m, Hpp.Types.HasError m) => Hpp.Types.HasError (Hpp.Types.HppT t m)
instance GHC.Base.Functor m => GHC.Base.Functor (Hpp.Types.HppT t m)
instance GHC.Base.Monad m => GHC.Base.Applicative (Hpp.Types.HppT t m)
instance GHC.Base.Monad m => GHC.Base.Monad (Hpp.Types.HppT t m)
instance Control.Monad.Trans.Class.MonadTrans (Hpp.Types.HppT t)
instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Hpp.Types.HppT t m)
instance GHC.Base.Functor (Hpp.Types.HppF t)
instance GHC.Base.Functor f => GHC.Base.Functor (Hpp.Types.FreeF f a)
instance GHC.Base.Monad m => Hpp.Types.HasError (Control.Monad.Trans.Except.ExceptT Hpp.Types.Error m)
instance (GHC.Base.Monad m, Hpp.Types.HasError m) => Hpp.Types.HasError (Control.Monad.Trans.State.Strict.StateT s m)
instance GHC.Exception.Exception Hpp.Types.Error


-- | Parsers over streaming input.
module Hpp.Parser

-- | A <a>Parser</a> is a bit of state that carries a source of input
--   consisting of a list of values which are either actions in an
--   underlying monad or sequences of inputs. Thus we have chunks of input
--   values with interspersed effects.
type Parser m i = ParserT m (RopeM m [i]) i

-- | A <a>ParserT</a> is a bit of state that carries a source of input.
type ParserT m src i = StateT (Headspring m src i, src) m

-- | Run a <a>Parser</a> with a given input stream.
parse :: Monad m => Parser m i o -> [i] -> m (o, RopeM m [i])
evalParse :: Monad m => Parser m i o -> [i] -> m o
await :: Monad m => ParserT m src i (Maybe i)

-- | <tt>awaitP</tt> that throws an error with the given message if no more
--   input is available. This may be used to locate where in a processing
--   pipeline input was unexpectedly exhausted.
awaitJust :: (Monad m, HasError m) => String -> ParserT m src i i

-- | Push a value back into a parser's source.
replace :: (Monad m) => i -> ParserT m src i ()

-- | Discard all values until one fails to satisfy a predicate. At that
--   point, the failing value is <a>replace</a>d, and the
--   <a>droppingWhile</a> stream stops.
droppingWhile :: (Monad m) => (i -> Bool) -> ParserT m src i ()

-- | Push a stream of values back into a parser's source.
precede :: Monad m => [i] -> ParserT m src i ()

-- | Echo all values until one fails to satisfy a predicate. At that point,
--   the failing value is <a>replace</a>d, and the <a>takingWhile</a>
--   stream stops.
takingWhile :: (Monad m) => (i -> Bool) -> ParserT m src i [i]
onChunks :: Monad m => ParserT m (RopeM m [i]) [i] r -> Parser m i r
onElements :: Monad m => ParserT m (RopeM m [[i]]) i r -> Parser m [i] r
onInputSegment :: Monad m => (src -> src) -> ParserT m (RopeM m src) i ()
insertInputSegment :: Monad m => src -> m () -> ParserT m (RopeM m src) i ()
onIsomorphism :: forall m a b src r. Monad m => (a -> b) -> (b -> Maybe a) -> ParserT m ([b], src) b r -> ParserT m src a r
runParser :: Monad m => Parser m i o -> RopeM m [i] -> m (o, RopeM m [i])


-- | Line expansion is the core input token processing logic. Object-like
--   macros are substituted, and function-like macro applications are
--   expanded.
module Hpp.Expansion

-- | Expand all macros to the end of the current line or until all
--   in-progress macro invocations are complete, whichever comes last.
expandLine :: (HasError m, Monad m, HasEnv m) => Config -> Int -> Parser m [TOKEN] [TOKEN]


-- | Mid-level interface to the pre-processor.
module Hpp.RunHpp

-- | Parse the definition of an object-like or function macro.
parseDefinition :: [TOKEN] -> Maybe (String, Macro)

-- | Run a stream of lines through the preprocessor.
preprocess :: (Monad m, HppCaps m) => [String] -> HppT [String] (Parser m [TOKEN]) ()

-- | Interpret the IO components of the preprocessor. This implementation
--   relies on IO for the purpose of checking search paths for included
--   files.
runHpp :: forall m a src. (MonadIO m) => Config -> (FilePath -> m src) -> (src -> m ()) -> HppT src m a -> m (Either (FilePath, Error) (HppResult a))

-- | Like ’runHpp’, but any <tt>#include</tt> directives are skipped. These
--   ignored inclusions are tracked in the returned list of files, but note
--   that since extra source files are not opened, any files they might
--   wish to include are not discovered.
expandHpp :: forall m a src. (Monad m, HasHppState m, Monoid src) => (src -> m ()) -> HppT src m a -> m (Either (FilePath, Error) (HppResult a))

-- | General hpp runner against input source file lines. Output lines are
--   fed to the caller-supplied sink function. Any errors encountered are
--   thrown with <a>error</a>.
hppIOSink :: Config -> Env -> ([String] -> IO ()) -> [String] -> IO [FilePath]

-- | The dynamic capabilities offered by HPP
type HppCaps t = (HasError t, HasHppState t, HasEnv t)

-- | hpp runner that returns output lines.
hppIO :: Config -> Env -> FilePath -> [String] -> IO (Either Error ([FilePath], [String]))
data HppResult a
HppResult :: [FilePath] -> a -> HppResult a
[hppFilesRead] :: HppResult a -> [FilePath]
[hppResult] :: HppResult a -> a


-- | Front-end interface to the pre-processor.
module Hpp

-- | Preprocess lines of input.
preprocess :: Monad m => [ByteString] -> HppT m ()

-- | Run a preprocessor action with some initial state. Returns the result
--   of preprocessing as well as an updated preprocessor state
--   representation.
runHpp :: MonadIO m => HppState -> HppT m a -> ExceptT Error m (HppOutput, HppState)

-- | <tt>streamHpp state sink action</tt> runs a preprocessor
--   <tt>action</tt> with some initial <tt>state</tt>. Output is streamed
--   to the caller-provided output <tt>sink</tt> as it is generated. The
--   list of files read during preprocessing is returned along with an
--   updated preprocessor state representation.
streamHpp :: MonadIO m => HppState -> ([ByteString] -> m ()) -> HppT m a -> ExceptT Error m ([FilePath], HppState)

-- | Like <a>runHpp</a>, but does not access the filesystem. Run a
--   preprocessor action with some initial state. Returns the result of
--   preprocessing as well as an updated preprocessor state representation.
--   Since this operation performs no IO, <tt>#include</tt> directives are
--   ignored in terms of the generated output lines, but the files named in
--   those directive are available in the <a>HppOutput</a> value returned.
expand :: HppState -> HppT (State ([ByteString] -> [ByteString])) a -> Except Error (HppOutput, HppState)

-- | Dynamic state of the preprocessor engine.
data HppState

-- | An <a>HppState</a> containing no macro definitions, and default values
--   for the starting configuration: the name of the current file is
--   <tt>"NoFile"</tt>, there are no paths to be searched for included
--   files, etc. See <a>Config</a> for more information on available
--   configuration.
emptyHppState :: HppState

-- | Create a <a>HppState</a> with the given <a>Config</a> and <a>Env</a>.
initHppState :: Config -> Env -> HppState

-- | Lower level parsing of macro definitions. Will typically be used with
--   <a>insertPair</a> for manual construction of a <a>Env</a> binding
--   environment.
parseDefinition :: ByteString -> ByteString -> Maybe (ByteString, Macro)

-- | <tt>addDefinition name expression</tt> adds a binding of <tt>name</tt>
--   to <tt>expression</tt> in the preprocessor’s internal state.
addDefinition :: ByteString -> ByteString -> HppState -> Maybe HppState

-- | The type of preprocessor actions. Created with <a>preprocess</a> and
--   executed with <a>runHpp</a> or <a>streamHpp</a>.
data HppT m a

-- | The result of running hpp
data HppOutput
HppOutput :: [FilePath] -> [ByteString] -> HppOutput
[hppFilesRead] :: HppOutput -> [FilePath]
[hppOutput] :: HppOutput -> [ByteString]
instance GHC.Base.Monad m => GHC.Base.Monad (Hpp.HppT m)
instance GHC.Base.Monad m => GHC.Base.Applicative (Hpp.HppT m)
instance GHC.Base.Functor m => GHC.Base.Functor (Hpp.HppT m)
instance Control.Monad.Trans.Class.MonadTrans Hpp.HppT


-- | A front-end to run Hpp with textual arguments as from a command line
--   invocation.
module Hpp.CmdLine

-- | Run Hpp with the given commandline arguments.
runWithArgs :: [String] -> IO ()
