Safe Haskell | None |
---|---|
Language | Haskell2010 |
- data ConfTree v
- class AMVTree t where
- (>=>) :: Monad m => (a -> m b) -> (b -> m c) -> a -> m c
- fromConfig :: Configuration s -> (ConfTree (StateVar Text) -> Maybe w) -> Clingo s (Maybe w)
- fromConfigMany :: Configuration s -> [ConfTree (StateVar Text) -> Maybe w] -> Clingo s [Maybe w]
- data StateVar a :: * -> *
- ($=) :: HasSetter t a => forall m. MonadIO m => t -> a -> m ()
- get :: HasGetter t a => forall m. MonadIO m => t -> m a
Tree interface
The configuration tree type, polymorphic over the leaf values.
CValue v | |
CMap (Maybe v) [(Text, ConfTree v)] | |
CArray (Maybe v) [(Int, ConfTree v)] | |
CBoth (Maybe v) [((Text, Int), ConfTree v)] |
Functor ConfTree Source # | |
Foldable ConfTree Source # | |
Traversable ConfTree Source # | |
AMVTree ConfTree Source # | |
Eq v => Eq (ConfTree v) Source # | |
Ord v => Ord (ConfTree v) Source # | |
Show v => Show (ConfTree v) Source # | |
Generic (ConfTree v) Source # | |
NFData v => NFData (ConfTree v) Source # | |
type Rep (ConfTree v) Source # | |
(>=>) :: Monad m => (a -> m b) -> (b -> m c) -> a -> m c infixr 1 #
Left-to-right Kleisli composition of monads.
fromConfig :: Configuration s -> (ConfTree (StateVar Text) -> Maybe w) -> Clingo s (Maybe w) Source #
Get a configuration option from the tree. If any lookup fails, the result
will be Nothing
. The tree will be traversed lazily, but the result is
evaluated before returning!
fromConfigMany :: Configuration s -> [ConfTree (StateVar Text) -> Maybe w] -> Clingo s [Maybe w] Source #
Like fromConfig
but supporting multiple paths.
Re-exported from StateVar
A concrete implementation of a readable and writable state variable, carrying one IO action to read the value and another IO action to write the new value. This data type represents a piece of mutable, imperative state with possible side-effects. These tend to encapsulate all sorts tricky behavior in external libraries, and may well throw exceptions. Inhabitants should satsify the following properties:
- In the absence of concurrent mutation from other threads or a thrown exception:
do x <-get
v; v$=
y; v$=
x
should restore the previous state.
- Ideally, in the absence of thrown exceptions:
v$=
a >>get
v
should return a
, regardless of a
. In practice some StateVar
s only
permit a very limited range of value assignments, and do not report failure.