Safe Haskell | None |
---|
The Ox monad facilitates writing functional expressions over the input sentence with arbitrary type of sentence token.
- type Ox o a = WriterT [(Id, o)] (State Id) a
- type Id = [Int]
- save :: Maybe o -> Ox o ()
- saves :: [o] -> Ox o ()
- when :: Bool -> Ox o a -> Ox o (Maybe a)
- whenJT :: Maybe Bool -> Ox o a -> Ox o (Maybe a)
- group :: Ox o a -> Ox o a
- execOx :: Ox o a -> [(Id, o)]
- atWith :: Vector a -> (a -> b) -> Int -> Maybe b
- atsWith :: Vector a -> (a -> [b]) -> Int -> [b]
Types
type Ox o a = WriterT [(Id, o)] (State Id) aSource
The Ox is a monad stack with observation type identifier handled by the state monad and the resulting observation values paired with identifiers printed using the writer monad.
Observation type identifier. It consists of a list of integers, each integer representing a state of the Ox monad on the particular level.
Functions
when :: Bool -> Ox o a -> Ox o (Maybe a)Source
Perform the Ox action only when the cond
is True. It works like
the standard when
function but also changes the current
identifier value.
whenJT :: Maybe Bool -> Ox o a -> Ox o (Maybe a)Source
Perform the action only when the given condition is equal to Just True.
group :: Ox o a -> Ox o aSource
Make all embedded observations to be indistinguishable with respect to their top-most identifier components. TODO: Perhaps should set only the current level, not the deeper ones.