achille-0.0.0: A library for building static site generators
Safe HaskellNone
LanguageHaskell2010

Achille.Internal

Description

Defines recipes, how they compose and evaluate.

Synopsis

Documentation

type Cache = ByteString Source #

A cache is a lazy bytestring.

emptyCache :: Cache Source #

The empty cache.

toCache :: Binary a => a -> Cache Source #

Cache a value.

fromCache :: Binary a => Cache -> Maybe a Source #

Retrieve a value from cache.

fromContext :: Binary a => Context b -> (Maybe a, Context b) Source #

Try to load a value from the cache, while respecting the rule for running the recipe. That is, if the rule must run, nothing will be returned. We also lower the run rule in the returned context, if possible.

The types are not explicit enough, should rewrite.

data MustRun Source #

Local rules for running a recipe

Constructors

MustRunOne

The current recipe, and only this one, must run

MustRunAll

All subsequent recipes must run

NoMust

No obligation, the current recipe will be run as normal

Instances

Instances details
Eq MustRun Source # 
Instance details

Defined in Achille.Internal

Methods

(==) :: MustRun -> MustRun -> Bool #

(/=) :: MustRun -> MustRun -> Bool #

data Context a Source #

Context in which a recipe is being executed.

Constructors

Context 

Fields

Instances

Instances details
Functor Context Source # 
Instance details

Defined in Achille.Internal

Methods

fmap :: (a -> b) -> Context a -> Context b #

(<$) :: a -> Context b -> Context a #

newtype Recipe m a b Source #

Description of a computation producing a value b given some input a.

Constructors

Recipe (Context a -> m (b, Cache)) 

Instances

Instances details
Monad m => Monad (Recipe m a) Source # 
Instance details

Defined in Achille.Internal

Methods

(>>=) :: Recipe m a a0 -> (a0 -> Recipe m a b) -> Recipe m a b #

(>>) :: Recipe m a a0 -> Recipe m a b -> Recipe m a b #

return :: a0 -> Recipe m a a0 #

Functor m => Functor (Recipe m a) Source # 
Instance details

Defined in Achille.Internal

Methods

fmap :: (a0 -> b) -> Recipe m a a0 -> Recipe m a b #

(<$) :: a0 -> Recipe m a b -> Recipe m a a0 #

MonadFail m => MonadFail (Recipe m a) Source # 
Instance details

Defined in Achille.Internal

Methods

fail :: String -> Recipe m a a0 #

Monad m => Applicative (Recipe m a) Source # 
Instance details

Defined in Achille.Internal

Methods

pure :: a0 -> Recipe m a a0 #

(<*>) :: Recipe m a (a0 -> b) -> Recipe m a a0 -> Recipe m a b #

liftA2 :: (a0 -> b -> c) -> Recipe m a a0 -> Recipe m a b -> Recipe m a c #

(*>) :: Recipe m a a0 -> Recipe m a b -> Recipe m a b #

(<*) :: Recipe m a a0 -> Recipe m a b -> Recipe m a a0 #

MonadIO m => MonadIO (Recipe m a) Source # 
Instance details

Defined in Achille.Internal

Methods

liftIO :: IO a0 -> Recipe m a a0 #

(Monad m, Semigroup b) => Semigroup (Recipe m a b) Source # 
Instance details

Defined in Achille.Internal

Methods

(<>) :: Recipe m a b -> Recipe m a b -> Recipe m a b #

sconcat :: NonEmpty (Recipe m a b) -> Recipe m a b #

stimes :: Integral b0 => b0 -> Recipe m a b -> Recipe m a b #

(Monad m, Monoid b) => Monoid (Recipe m a b) Source # 
Instance details

Defined in Achille.Internal

Methods

mempty :: Recipe m a b #

mappend :: Recipe m a b -> Recipe m a b -> Recipe m a b #

mconcat :: [Recipe m a b] -> Recipe m a b #

type Task m = Recipe m () Source #

A task is a recipe with no input

runRecipe :: Recipe m a b -> Context a -> m (b, Cache) Source #

Run a recipe with a given context.

nonCached :: Functor m => (Context a -> m b) -> Recipe m a b Source #

Make a recipe out of a computation that is known not to be cached.