| Copyright | (c) roki 2019 |
|---|---|
| License | MIT |
| Maintainer | falgon53@yahoo.co.jp |
| Stability | experimental |
| Portability | POSIX |
| Safe Haskell | None |
| Language | Haskell2010 |
Htcc.Utils.CompilationState
Description
General-purpose utilities
Synopsis
- type CompilationState cd inp i r = StateT (cd, inp) (Either (ASTError i)) r
- itemP :: MonoFoldable mono => CompilationState cd mono i (Maybe (Element mono))
- itemsP :: (MonoFoldable mono, IsSequence mono) => Index mono -> CompilationState cd mono i (Maybe mono)
- itemC :: IsSequence mono => (cd -> Element mono -> cd) -> CompilationState cd mono i (Maybe (Element mono))
- itemsC :: IsSequence mono => (cd -> Element mono -> cd) -> Int -> CompilationState cd mono i (Maybe mono)
- curCD :: CompilationState cd mono i cd
- itemCWhen :: (MonoFoldable mono, IsSequence mono) => (cd -> Element mono -> cd) -> (Element mono -> Bool) -> CompilationState cd mono i (Maybe (Element mono))
- itemsCWhen :: (MonoFoldable mono, IsSequence mono) => (cd -> Element mono -> cd) -> (Element mono -> Bool) -> CompilationState cd mono i mono
- isSatisfied :: (mono -> Bool) -> CompilationState cd mono i Bool
Documentation
type CompilationState cd inp i r = StateT (cd, inp) (Either (ASTError i)) r Source #
The state type handled during compilation. It has informations required during the compilation process and input data consumed.
itemP :: MonoFoldable mono => CompilationState cd mono i (Maybe (Element mono)) Source #
itemP peeks at one item from input data
itemsP :: (MonoFoldable mono, IsSequence mono) => Index mono -> CompilationState cd mono i (Maybe mono) Source #
itemsP peeks at items from input data
itemC :: IsSequence mono => (cd -> Element mono -> cd) -> CompilationState cd mono i (Maybe (Element mono)) Source #
itemC consumes at one item from input data.
Defines information updates by providing a function that
accepts the current information and one item to be consumed and returns the information
itemsC :: IsSequence mono => (cd -> Element mono -> cd) -> Int -> CompilationState cd mono i (Maybe mono) Source #
itemsC consumes at items from input data.
Defines information updates by providing a function that
accepts the current information and one item to be consumed and returns the information
curCD :: CompilationState cd mono i cd Source #
curCD gets current information
itemCWhen :: (MonoFoldable mono, IsSequence mono) => (cd -> Element mono -> cd) -> (Element mono -> Bool) -> CompilationState cd mono i (Maybe (Element mono)) Source #
itemCWhen consumes an item when the unary function satisfies the given condition.
Defines information updates by providing a function that
accepts the current information and one item to be consumed and returns the information
itemsCWhen :: (MonoFoldable mono, IsSequence mono) => (cd -> Element mono -> cd) -> (Element mono -> Bool) -> CompilationState cd mono i mono Source #
itemsCWhen consumes items when the unary function satisfies the given condition.
Defines information updates by providing a function that
accepts the current information and one item to be consumed and returns the information
isSatisfied :: (mono -> Bool) -> CompilationState cd mono i Bool Source #
isSatisfied returns True if the input data satisfies the condition of given unary function, otherwise returns False.