1-- | Internal structure of a Target, not exported outside of the library
3{-# LANGUAGE GeneralizedNewtypeDeriving #-}
4module Hakyll.Core.Target.Internal
6 , TargetEnvironment (..)
12import Control.Applicative (Applicative)
13import Control.Monad.Trans (MonadIO)
14import Control.Monad.Reader (ReaderT, runReaderT)
16import Hakyll.Core.Identifier
17import Hakyll.Core.ResourceProvider
19-- | A lookup with which we can get dependencies
21type DependencyLookup a = Identifier -> a
23-- | Environment for the target monad
25data TargetEnvironment a = TargetEnvironment
26 { targetIdentifier :: Identifier -- ^ Identifier
27 , targetDependencyLookup :: DependencyLookup a -- ^ Dependency lookup
28 , targetResourceProvider :: ResourceProvider -- ^ To get resources
31-- | Monad for targets. In this monad, the user can compose targets and describe
32-- how they should be created.
34newtype TargetM a b = TargetM {unTargetM :: ReaderT (TargetEnvironment a) IO b}
35 deriving (Monad, Functor, Applicative, MonadIO)
37-- | Simplification of the 'TargetM' type for concrete cases: the type of the
38-- returned item should equal the type of the dependencies.
40type Target a = TargetM a a
42-- | Run a target, yielding an actual result.
49runTarget target id' lookup' provider = runReaderT (unTargetM target) env
51 env = TargetEnvironment
52 { targetIdentifier = id'
53 , targetDependencyLookup = lookup'
54 , targetResourceProvider = provider
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list