diff options
Diffstat (limited to 'src/Hakyll/Core/Compiler/Internal.hs')
-rw-r--r-- | src/Hakyll/Core/Compiler/Internal.hs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/Hakyll/Core/Compiler/Internal.hs b/src/Hakyll/Core/Compiler/Internal.hs index 5ae2f5b..f1d591d 100644 --- a/src/Hakyll/Core/Compiler/Internal.hs +++ b/src/Hakyll/Core/Compiler/Internal.hs @@ -14,7 +14,7 @@ module Hakyll.Core.Compiler.Internal ) where import Prelude hiding ((.), id) -import Control.Applicative (Applicative, (<$>)) +import Control.Applicative (Applicative, pure, (<*>), (<$>)) import Control.Monad.Reader (ReaderT, Reader, ask, runReaderT, runReader) import Control.Monad ((<=<), liftM2) import Data.Set (Set) @@ -58,6 +58,14 @@ data Compiler a b = Compiler , compilerJob :: a -> CompilerM b } +instance Functor (Compiler a) where + fmap f (Compiler d j) = Compiler d $ fmap f . j + +instance Applicative (Compiler a) where + pure = Compiler (return S.empty) . const . return + (Compiler d1 f) <*> (Compiler d2 j) = + Compiler (liftM2 S.union d1 d2) $ \x -> f x <*> j x + instance Category Compiler where id = Compiler (return S.empty) return (Compiler d1 j1) . (Compiler d2 j2) = |