hakyll-4.13.0.1: A static website compiler library

Safe HaskellNone
LanguageHaskell2010

Hakyll.Core.Rules

Contents

Description

This module provides a declarative DSL in which the user can specify the different rules used to run the compilers.

The convention is to just list all items in the Rules monad, routes and compilation rules.

A typical usage example would be:

main = hakyll $ do
    match "posts/*" $ do
        route   (setExtension "html")
        compile someCompiler
    match "css/*" $ do
        route   idRoute
        compile compressCssCompiler
Synopsis

Documentation

data Rules a Source #

The monad used to compose rules

Instances
Monad Rules Source # 
Instance details

Defined in Hakyll.Core.Rules.Internal

Methods

(>>=) :: Rules a -> (a -> Rules b) -> Rules b #

(>>) :: Rules a -> Rules b -> Rules b #

return :: a -> Rules a #

fail :: String -> Rules a #

Functor Rules Source # 
Instance details

Defined in Hakyll.Core.Rules.Internal

Methods

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

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

Applicative Rules Source # 
Instance details

Defined in Hakyll.Core.Rules.Internal

Methods

pure :: a -> Rules a #

(<*>) :: Rules (a -> b) -> Rules a -> Rules b #

liftA2 :: (a -> b -> c) -> Rules a -> Rules b -> Rules c #

(*>) :: Rules a -> Rules b -> Rules b #

(<*) :: Rules a -> Rules b -> Rules a #

MonadMetadata Rules Source # 
Instance details

Defined in Hakyll.Core.Rules.Internal

match :: Pattern -> Rules () -> Rules () Source #

create :: [Identifier] -> Rules () -> Rules () Source #

version :: String -> Rules () -> Rules () Source #

compile :: (Binary a, Typeable a, Writable a) => Compiler (Item a) -> Rules () Source #

Add a compilation rule to the rules.

This instructs all resources to be compiled using the given compiler.

route :: Routes -> Rules () Source #

Add a route.

This adds a route for all items matching the current pattern.

Advanced usage

preprocess :: IO a -> Rules a Source #

Execute an IO action immediately while the rules are being evaluated. This should be avoided if possible, but occasionally comes in useful.

rulesExtraDependencies :: [Dependency] -> Rules a -> Rules a Source #

Advanced usage: add extra dependencies to compilers. Basically this is needed when you're doing unsafe tricky stuff in the rules monad, but you still want correct builds.

A useful utility for this purpose is makePatternDependency.