@@ -97,53 +97,87 @@ data Compiler a b = Compiler
98--------------------------------------------------------------------------------
98--------------------------------------------------------------------------------
99instance Functor (Compiler a) where
99instance Functor (Compiler a) where
100− fmap f ~(Compiler d j) = Compiler d $ fmap f . j
100+ fmap f (Compiler d j) = Compiler d $ fmap f . j
103--------------------------------------------------------------------------------
104--------------------------------------------------------------------------------
104instance Applicative (Compiler a) where
105instance Applicative (Compiler a) where
105 pure = fromJob . const . return
106 pure = fromJob . const . return
106− ~(Compiler d1 j1) <*> ~(Compiler d2 j2) =
109+ Compiler d1 j1 <*> Compiler d2 j2 =
107 Compiler (liftM2 S.union d1 d2) $ \x -> j1 x <*> j2 x
110 Compiler (liftM2 S.union d1 d2) $ \x -> j1 x <*> j2 x
111+ {-# INLINE (<*>) #-}
110--------------------------------------------------------------------------------
114--------------------------------------------------------------------------------
111instance Alternative (Compiler a) where
115instance Alternative (Compiler a) where
112 empty = fromJob $ const $ CompilerM $
116 empty = fromJob $ const $ CompilerM $
113 throwError "Hakyll.Core.Compiler.Internal: empty alternative"
117 throwError "Hakyll.Core.Compiler.Internal: empty alternative"
114− ~(Compiler d1 j1) <|> ~(Compiler d2 j2) =
119+ Compiler d1 j1 <|> Compiler d2 j2 =
115 Compiler (liftM2 S.union d1 d2) $ \x -> CompilerM $
120 Compiler (liftM2 S.union d1 d2) $ \x -> CompilerM $
116 catchError (unCompilerM $ j1 x) (\_ -> unCompilerM $ j2 x)
121 catchError (unCompilerM $ j1 x) (\_ -> unCompilerM $ j2 x)
122+ {-# INLINE (<|>) #-}
119--------------------------------------------------------------------------------
125--------------------------------------------------------------------------------
120instance Category Compiler where
126instance Category Compiler where
121 id = Compiler (return S.empty) return
127 id = Compiler (return S.empty) return
122− ~(Compiler d1 j1) . ~(Compiler d2 j2) =
130+ Compiler d1 j1 . Compiler d2 j2 =
123 Compiler (liftM2 S.union d1 d2) (j1 <=< j2)
131 Compiler (liftM2 S.union d1 d2) (j1 <=< j2)
126--------------------------------------------------------------------------------
135--------------------------------------------------------------------------------
127instance Arrow Compiler where
136instance Arrow Compiler where
128 arr f = fromJob (return . f)
137 arr f = fromJob (return . f)
129− first ~(Compiler d j) = Compiler d $ \(x, y) -> do
140+ first (Compiler d j) = Compiler d $ \(x, y) -> do
130 x' <- j x
141 x' <- j x
131 return (x', y)
142 return (x', y)
143+ {-# INLINE first #-}
145+ second (Compiler d j) = Compiler d $ \(x, y) -> do
148+ {-# INLINE second #-}
150+ Compiler d1 j1 *** Compiler d2 j2 =
151+ Compiler (liftM2 S.union d1 d2) $ \(x, y) -> do
155+ {-# INLINE (***) #-}
157+ Compiler d1 j1 &&& Compiler d2 j2 =
158+ Compiler (liftM2 S.union d1 d2) $ \x -> do
162+ {-# INLINE (&&&) #-}
134--------------------------------------------------------------------------------
165--------------------------------------------------------------------------------
135instance ArrowChoice Compiler where
166instance ArrowChoice Compiler where
136− left ~(Compiler d j) = Compiler d $ \e -> case e of
167+ left (Compiler d j) = Compiler d $ \e -> case e of
137 Left l -> Left <$> j l
168 Left l -> Left <$> j l
138 Right r -> Right <$> return r
169 Right r -> Right <$> return r
139− -- Defined here for efficiency
170+ {-# INLINE left #-}
140− ~(Compiler d1 j1) ||| ~(Compiler d2 j2) = Compiler (liftM2 S.union d1 d2) $
172+ Compiler d1 j1 ||| Compiler d2 j2 = Compiler (liftM2 S.union d1 d2) $
141 \e -> case e of Left x -> j1 x; Right y -> j2 y
173 \e -> case e of Left x -> j1 x; Right y -> j2 y
174+ {-# INLINE (|||) #-}
144--------------------------------------------------------------------------------
177--------------------------------------------------------------------------------
145instance ArrowMap Compiler where
178instance ArrowMap Compiler where
146 mapA (Compiler d j) = Compiler d $ mapM j
179 mapA (Compiler d j) = Compiler d $ mapM j
149--------------------------------------------------------------------------------
183--------------------------------------------------------------------------------