funflow-1.3.2: Workflows with arrows

Safe HaskellNone
LanguageHaskell2010

Control.Funflow

Contents

Description

Central Funflow module.

This module just re-exports various other modules for convenience.

Synopsis

Documentation

type Flow eff ex = ErrorChoice ex (Flow' eff) Source #

data NoEffect a b Source #

data Flow' eff a b where Source #

Constructors

Step :: Properties a b -> (a -> b) -> Flow' eff a b 
StepIO :: Properties a b -> (a -> IO b) -> Flow' eff a b 
External :: ExternalProperties a -> (a -> ExternalTask) -> Flow' eff a Item 
PutInStore :: ContentHashable IO a => (Path Abs Dir -> a -> IO ()) -> Flow' eff a Item 
GetFromStore :: (Path Abs t -> IO a) -> Flow' eff (Content t) a 
InternalManipulateStore :: (ContentStore -> a -> IO b) -> Flow' eff a b 
Wrapped :: Properties a b -> eff a b -> Flow' eff a b 
Instances
ArrowFlow eff ex (Flow eff ex) Source # 
Instance details

Defined in Control.Funflow.Class

Methods

step' :: Properties a b -> (a -> b) -> Flow eff ex a b Source #

stepIO' :: Properties a b -> (a -> IO b) -> Flow eff ex a b Source #

external :: (a -> ExternalTask) -> Flow eff ex a Item Source #

external' :: ExternalProperties a -> (a -> ExternalTask) -> Flow eff ex a Item Source #

wrap' :: Properties a b -> eff a b -> Flow eff ex a b Source #

putInStore :: ContentHashable IO a => (Path Abs Dir -> a -> IO ()) -> Flow eff ex a Item Source #

getFromStore :: (Path Abs t -> IO a) -> Flow eff ex (Content t) a Source #

internalManipulateStore :: (ContentStore -> a -> IO b) -> Flow eff ex a b Source #

data Cacher i o Source #

A cacher is responsible for controlling how steps are cached.

Constructors

NoCache

This step cannot be cached (default).

Cache 

Fields

data ExternalProperties a Source #

Additional properties associated with external tasks.

Constructors

ExternalProperties 

Fields

  • ep_mdpolicy :: MDWriter a ()

    Write additional metadata to the content store.

  • ep_impure :: Bool

    Specify that this external step is impure, and as such should not be cached.

Instances
Default (ExternalProperties a) Source # 
Instance details

Defined in Control.Funflow.Base

type MDWriter i o = Maybe (i -> o -> [(Text, ByteString)]) Source #

Metadata writer

data Properties i o Source #

Constructors

Properties 

Fields

  • name :: Maybe Text

    Name of this step. Used when describing the step in diagrams or other reporting.

  • cache :: Cacher i o

    Specify whether this step can be cached or not and, if so, how to do so.

  • mdpolicy :: MDWriter i o

    Write additional metadata to the content store.

Instances
Default (Properties i o) Source # 
Instance details

Defined in Control.Funflow.Base

Methods

def :: Properties i o #

defaultCacherWithIdent Source #

Arguments

:: (Store o, ContentHashable Identity i) 
=> Int

Seed for the cacher

-> Cacher i o 

defaultCacher :: Q Exp Source #

Create a default cacher with a random identity.

Note that this cacher is deliberately conservative - e.g. if the application is recompiled, the cache will not be reused.

defaultCacherLoc Source #

Arguments

:: Int

Version

-> Q Exp 

Create a default cacher based on the location of this splice. Note that this may lead to invalid cacheing if the code is changed without the version being updated.

Defines our primitive flow functions

class (ArrowChoice arr, ArrowError ex arr) => ArrowFlow eff ex arr | arr -> eff ex where Source #

Methods

step' :: Properties a b -> (a -> b) -> arr a b Source #

Create a flow from a pure function.

stepIO' :: Properties a b -> (a -> IO b) -> arr a b Source #

Create a flow from an IO action.

external :: (a -> ExternalTask) -> arr a Item Source #

Create an external task in the flow.

external' :: ExternalProperties a -> (a -> ExternalTask) -> arr a Item Source #

Create an external task with additional properties

wrap' :: Properties a b -> eff a b -> arr a b Source #

Create a flow from a user-defined effect.

putInStore :: ContentHashable IO a => (Path Abs Dir -> a -> IO ()) -> arr a Item Source #

Create a flow which will write its incoming data to the store.

getFromStore :: (Path Abs t -> IO a) -> arr (Content t) a Source #

Create a flow which will read data from the given store item.

internalManipulateStore :: (ContentStore -> a -> IO b) -> arr a b Source #

Perform some internal manipulation of the content store.

Instances
ArrowFlow eff ex (Flow eff ex) Source # 
Instance details

Defined in Control.Funflow.Class

Methods

step' :: Properties a b -> (a -> b) -> Flow eff ex a b Source #

stepIO' :: Properties a b -> (a -> IO b) -> Flow eff ex a b Source #

external :: (a -> ExternalTask) -> Flow eff ex a Item Source #

external' :: ExternalProperties a -> (a -> ExternalTask) -> Flow eff ex a Item Source #

wrap' :: Properties a b -> eff a b -> Flow eff ex a b Source #

putInStore :: ContentHashable IO a => (Path Abs Dir -> a -> IO ()) -> Flow eff ex a Item Source #

getFromStore :: (Path Abs t -> IO a) -> Flow eff ex (Content t) a Source #

internalManipulateStore :: (ContentStore -> a -> IO b) -> Flow eff ex a b Source #

step :: ArrowFlow eff ex arr => (a -> b) -> arr a b Source #

Create a flow from a pure function. This is a variant on step' which uses the default properties.

stepIO :: ArrowFlow eff ex arr => (a -> IO b) -> arr a b Source #

Create a flow from an IO action. This is a variant on stepIO' which uses the default properties.

wrap :: ArrowFlow eff ex arr => eff a b -> arr a b Source #

withStore :: (MonadIO m, MonadMask m) => Path Abs Dir -> (ContentStore -> m a) -> m a Source #

Open the store under the given root and perform the given action. Closes the store once the action is complete

See also: open