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 #

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

data CompilerRead #

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 #

Constructors

CompilerWrite |
Fields compilerDependencies :: [Dependency] compilerCacheHits :: Int

Instances

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

data CompilerResult a where #

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 #

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

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

# Core operations

compilerTell :: CompilerWrite -> Compiler () #

compilerAsk :: Compiler CompilerRead #

compilerThrow :: [String] -> Compiler a #

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

compilerResult :: CompilerResult a -> Compiler a #

Put the result back in a compiler

compilerUnsafeIO :: IO a -> Compiler a #

# Utilities

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

compilerTellCacheHits :: Int -> Compiler () #