@@ -14,7 +14,7 @@ module Hakyll.Core.Compiler.Internal
1414 ) where
1515
1616import Prelude hiding ((.), id)
17−import Control.Applicative (Applicative, (<$>))
17+import Control.Applicative (Applicative, pure, (<*>), (<$>))
1818import Control.Monad.Reader (ReaderT, Reader, ask, runReaderT, runReader)
1919import Control.Monad ((<=<), liftM2)
2020import Data.Set (Set)
@@ -58,6 +58,14 @@ data Compiler a b = Compiler
5858 , compilerJob :: a -> CompilerM b
5959 }
6060
61+instance Functor (Compiler a) where
62+ fmap f (Compiler d j) = Compiler d $ fmap f . j
63+
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
68+
6169instance Category Compiler where
6270 id = Compiler (return S.empty) return
6371 (Compiler d1 j1) . (Compiler d2 j2) =