Safe Haskell | Safe |
---|---|

Language | Haskell2010 |

Monadic tasks, as used by Excel, Shake and other build systems. Dependencies of monadic tasks can only be discovered dynamically, i.e. during their execution.

## Synopsis

- track :: forall m k v. Monad m => Task Monad k v -> (k -> m v) -> m (v, [(k, v)])
- trackPure :: Task Monad k v -> (k -> v) -> (v, [k])
- isInput :: Tasks Monad k v -> k -> Bool
- computePure :: Task Monad k v -> (k -> v) -> v
- compute :: Task Monad k v -> Store i k v -> v
- partial :: Task Monad k v -> Task Monad k (Maybe v)
- exceptional :: Task Monad k v -> Task Monad k (Either e v)

# Documentation

track :: forall m k v. Monad m => Task Monad k v -> (k -> m v) -> m (v, [(k, v)]) Source #

Execute a monadic task using an effectful fetch function `k -> m v`

,
tracking the dependencies.

trackPure :: Task Monad k v -> (k -> v) -> (v, [k]) Source #

Execute a monadic task on a pure store `k -> v`

, tracking the dependencies.

isInput :: Tasks Monad k v -> k -> Bool Source #

Given a description of tasks, check if a key is input.

computePure :: Task Monad k v -> (k -> v) -> v Source #

Run a task with a pure lookup function.

partial :: Task Monad k v -> Task Monad k (Maybe v) Source #

Convert a task with a total lookup function `k -> m v`

into a task with a
partial lookup function `k -> m (Maybe v)`

. This essentially lifts the task
from the type of values `v`

to `Maybe v`

, where the result `Nothing`

indicates that the task failed because of a missing dependency.

exceptional :: Task Monad k v -> Task Monad k (Either e v) Source #

Convert a task with a total lookup function `k -> m v`

into a task with a
lookup function that can throw exceptions `k -> m (Either e v)`

. This
essentially lifts the task from the type of values `v`

to `Either e v`

, where
the result `Left e`

indicates that the task failed because of a failed
dependency lookup, and `Right v`

yeilds the value otherwise.