hakyll-4.9.8.0: A static website compiler library

Safe Haskell | None
Language | Haskell98

Hakyll.Core.Compiler.Internal

Contents

- Types
- Core operations
- Utilities

Description

Internally used compiler module

Synopsis

- type Snapshot = String
- data CompilerRead = CompilerRead {
  - compilerConfig :: Configuration
  - compilerUnderlying :: Identifier
  - compilerProvider :: Provider
  - compilerUniverse :: Set Identifier
  - compilerRoutes :: Routes
  - compilerStore :: Store
  - compilerLogger :: Logger
  }
- data CompilerWrite = CompilerWrite {
  - compilerDependencies :: [Dependency]
  - compilerCacheHits :: Int
  }
- data CompilerResult a where
  - CompilerDone :: a -> CompilerWrite -> CompilerResult a
  - CompilerSnapshot :: Snapshot -> Compiler a -> CompilerResult a
  - CompilerError :: [String] -> CompilerResult a
  - CompilerRequire :: (Identifier, Snapshot) -> Compiler a -> CompilerResult a
- newtype Compiler a = Compiler {
  - unCompiler :: CompilerRead -> IO (CompilerResult a)
  }
- runCompiler :: Compiler a -> CompilerRead -> IO (CompilerResult a)
- compilerTell :: CompilerWrite -> Compiler ()
- compilerAsk :: Compiler CompilerRead
- compilerThrow :: [String] -> Compiler a
- compilerCatch :: Compiler a -> ([String] -> Compiler a) -> Compiler a
- compilerResult :: CompilerResult a -> Compiler a
- compilerUnsafeIO :: IO a -> Compiler a
- compilerTellDependencies :: [Dependency] -> Compiler ()
- compilerTellCacheHits :: Int -> Compiler ()

# Types

type Snapshot = String Source #

Whilst compiling an item, it possible to save multiple snapshots of it, and not just the final result.

data CompilerRead Source #

Environment in which a compiler runs

Constructors

CompilerRead |

Fields

- compilerConfig :: Configuration

  Main configuration

- compilerUnderlying :: Identifier

  Underlying identifier

- compilerProvider :: Provider

  Resource provider

- compilerUniverse :: Set Identifier

  List of all known identifiers

- compilerRoutes :: Routes

  Site routes

- compilerStore :: Store

  Compiler store

- compilerLogger :: Logger

  Logger

data CompilerWrite Source #

Constructors

CompilerWrite |

Fields

- compilerDependencies :: [Dependency]
- compilerCacheHits :: Int

Instances

Show CompilerWrite Source # |
Methods showsPrec :: Int -> CompilerWrite -> ShowS # show :: CompilerWrite -> String # showList :: [CompilerWrite] -> ShowS #
Monoid CompilerWrite Source # |
Methods mempty :: CompilerWrite # mappend :: CompilerWrite -> CompilerWrite -> CompilerWrite # mconcat :: [CompilerWrite] -> CompilerWrite #

data CompilerResult a where Source #

Constructors

CompilerDone :: a -> CompilerWrite -> CompilerResult a |
CompilerSnapshot :: Snapshot -> Compiler a -> CompilerResult a |
CompilerError :: [String] -> CompilerResult a |
CompilerRequire :: (Identifier, Snapshot) -> Compiler a -> CompilerResult a |

newtype Compiler a Source #

A monad which lets you compile items and takes care of dependency tracking for you.

Constructors

Compiler |

Fields

- unCompiler :: CompilerRead -> IO (CompilerResult a)

Instances

Monad Compiler Source # |
Methods (>>=) :: Compiler a -> (a -> Compiler b) -> Compiler b # (>>) :: Compiler a -> Compiler b -> Compiler b # return :: a -> Compiler a # fail :: String -> Compiler a #
Functor Compiler Source # |
Methods fmap :: (a -> b) -> Compiler a -> Compiler b # (<$) :: a -> Compiler b -> Compiler a #
Applicative Compiler Source # |
Methods pure :: a -> Compiler a # (<*>) :: Compiler (a -> b) -> Compiler a -> Compiler b # (*>) :: Compiler a -> Compiler b -> Compiler b # (<*) :: Compiler a -> Compiler b -> Compiler a #
Alternative Compiler Source # |
Methods empty :: Compiler a # (<|>) :: Compiler a -> Compiler a -> Compiler a # some :: Compiler a -> Compiler [a] # many :: Compiler a -> Compiler [a] #
MonadMetadata Compiler Source # |
Methods getMetadata :: Identifier -> Compiler Metadata Source # getMatches :: Pattern -> Compiler [Identifier] Source # getAllMetadata :: Pattern -> Compiler [(Identifier, Metadata)] Source #
MonadError [String] Compiler Source # |
Methods throwError :: [String] -> Compiler a # catchError :: Compiler a -> ([String] -> Compiler a) -> Compiler a #

runCompiler :: Compiler a -> CompilerRead -> IO (CompilerResult a) Source #

# Core operations

compilerTell :: CompilerWrite -> Compiler () Source #

compilerAsk :: Compiler CompilerRead Source #

compilerThrow :: [String] -> Compiler a Source #

compilerCatch :: Compiler a -> ([String] -> Compiler a) -> Compiler a Source #

compilerResult :: CompilerResult a -> Compiler a Source #

Put the result back in a compiler

compilerUnsafeIO :: IO a -> Compiler a Source #

# Utilities

compilerTellDependencies :: [Dependency] -> Compiler () Source #

compilerTellCacheHits :: Int -> Compiler () Source #