on master help sign in
Lazy pattern matching for compiler composition
f56eb53Jasper Van der Jeugt
src/Hakyll/Core/Compiler/Internal.hs+1−1
@@ -69,7 +69,7 @@ instance Applicative (Compiler a) where
69
69
70instance Category Compiler where
70instance Category Compiler where
71 id = Compiler (return S.empty) return
71 id = Compiler (return S.empty) return
72− (Compiler d1 j1) . (Compiler d2 j2) =
72+ ~(Compiler d1 j1) . ~(Compiler d2 j2) =
73 Compiler (liftM2 S.union d1 d2) (j1 <=< j2)
73 Compiler (liftM2 S.union d1 d2) (j1 <=< j2)
74
74
75instance Arrow Compiler where
75instance Arrow Compiler where
src/Hakyll/Core/Util/Arrow.hs+3−1
@@ -7,6 +7,8 @@ module Hakyll.Core.Util.Arrow
7 , mapA
7 , mapA
8 ) where
8 ) where
9
9
10+import Prelude hiding (id)
11+import Control.Category (id)
10import Control.Arrow ( Arrow, ArrowChoice, (&&&), arr, (>>^), (|||)
12import Control.Arrow ( Arrow, ArrowChoice, (&&&), arr, (>>^), (|||)
11 , (>>>), (***)
13 , (>>>), (***)
12 )
14 )
@@ -30,7 +32,7 @@ unitA = constA ()
30mapA :: ArrowChoice a
32mapA :: ArrowChoice a
31 => a b c
33 => a b c
32 -> a [b] [c]
34 -> a [b] [c]
33−mapA f = arr listEither >>> arr id ||| (f *** mapA f >>> arr (uncurry (:)))
35+mapA f = arr listEither >>> id ||| (f *** mapA f >>> arr (uncurry (:)))
34 where
36 where
35 listEither [] = Left []
37 listEither [] = Left []
36 listEither (x : xs) = Right (x, xs)
38 listEither (x : xs) = Right (x, xs)