build-0.0.1.1: Build systems a la carte

Safe HaskellSafe
LanguageHaskell2010

Build.Task.Monad

Description

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

Documentation

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

Execute a monadic task on a pure store k -> v, tracking the dependencies.

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

Execute a monadic task using an effectful fetch function k -> m v, tracking the dependencies.

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

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

compute :: 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.