on master help sign in
Instantiate ArrowChoice for Compiler
commitec9c1ec0db7a7dfc4650b9d1d68069b3bb32bdc4 authorJasper Van der Jeugt <jaspervdj@gmail.com> dateSat 5 Feb 2011, 13:38 (16 years ago) parentc093761
1 file changed+6−1
src/Hakyll/Core/Compiler/Internal.hs+6−1
src/Hakyll/Core/Compiler/Internal.hs+6−1
@@ -20,7 +20,7 @@ import Control.Monad ((<=<), liftM2)
2020import Data.Set (Set)
2121import qualified Data.Set as S
2222import Control.Category (Category, (.), id)
23−import Control.Arrow (Arrow, arr, first)
23+import Control.Arrow (Arrow, ArrowChoice, arr, first, left)
2424
2525import Hakyll.Core.Identifier
2626import Hakyll.Core.ResourceProvider
@@ -78,6 +78,11 @@ instance Arrow Compiler where
7878 x' <- j x
7979 return (x', y)
8080
81+instance ArrowChoice Compiler where
82+ left (Compiler d j) = Compiler d $ \e -> case e of
83+ Left l -> Left <$> j l
84+ Right r -> Right <$> return r
85+
8186-- | Run a compiler, yielding the resulting target and it's dependencies
8287--
8388runCompilerJob :: Compiler () a -- ^ Compiler to run