Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Hpp.Types
Description
The core types involved used by the pre-processor.
- type LineNum = Int
- data Error
- = UnterminatedBranch
- | BadMacroDefinition LineNum
- | BadIfPredicate
- | BadLineArgument LineNum String
- | IncludeDoesNotExist LineNum FilePath
- | FailedInclude LineNum FilePath
- | UserError LineNum String
- | UnknownCommand LineNum String
- | TooFewArgumentsToMacro LineNum String
- | BadMacroArguments LineNum String
- | NoInputFile
- | BadCommandLine String
- data Hpp a
- newtype ErrHpp a = ErrHpp {}
- data Scan
- type DList a = [a] -> [a]
- data Macro
Documentation
Errors
Error conditions we may encounter.
Constructors
Pre-processor Actions
A free monad construction to strictly delimit what capabilities we need to perform pre-processing.
An Hpp
action that can fail.
Expansion
Macro expansion involves treating tokens differently if they appear in the original source for 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 not 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 not be expanded.
type DList a = [a] -> [a] Source
A difference list is a list representation with O(1)
snoc
'ing at
the end of the list.
Macros
There are object-like macros and function-like macros.