@@ -14,7 +14,7 @@ module Hakyll.Core.Compiler.Internal
16import Prelude hiding ((.), id)
16import Prelude hiding ((.), id)
17−import Control.Applicative (Applicative, (<$>))
17+import Control.Applicative (Applicative, pure, (<*>), (<$>))
18import Control.Monad.Reader (ReaderT, Reader, ask, runReaderT, runReader)
18import Control.Monad.Reader (ReaderT, Reader, ask, runReaderT, runReader)
19import Control.Monad ((<=<), liftM2)
19import Control.Monad ((<=<), liftM2)
20import Data.Set (Set)
20import Data.Set (Set)
@@ -58,6 +58,14 @@ data Compiler a b = Compiler
58 , compilerJob :: a -> CompilerM b
58 , compilerJob :: a -> CompilerM b
61+instance Functor (Compiler a) where
62+ fmap f (Compiler d j) = Compiler d $ fmap f . j
64+instance Applicative (Compiler a) where
65+ pure = Compiler (return S.empty) . const . return
66+ (Compiler d1 f) <*> (Compiler d2 j) =
67+ Compiler (liftM2 S.union d1 d2) $ \x -> f x <*> j x
61instance Category Compiler where
69instance Category Compiler where
62 id = Compiler (return S.empty) return
70 id = Compiler (return S.empty) return
63 (Compiler d1 j1) . (Compiler d2 j2) =
71 (Compiler d1 j1) . (Compiler d2 j2) =