on master help sign in
Added Arrow implementation for RenderAction.
commit0204dd678a4da1589126868f4e8e588fa132b07d authorJasper Van der Jeugt <jaspervdj@gmail.com> dateTue 9 Mar 2010, 18:26 (17 years ago) parent4756b82
1 file changed+11
src/Text/Hakyll/RenderAction.hs+11
src/Text/Hakyll/RenderAction.hs+11
@@ -11,6 +11,7 @@ module Text.Hakyll.RenderAction
1111 , Renderable
1212 ) where
1313
14+import Control.Arrow
1415import Control.Category
1516import Control.Monad ((<=<), mplus, unless)
1617import Control.Monad.Reader (liftIO)
@@ -96,3 +97,13 @@ instance Category RenderAction where
9697 , actionUrl = actionUrl y `mplus` actionUrl x
9798 , actionFunction = actionFunction x <=< actionFunction y
9899 }
100+
101+instance Arrow RenderAction where
102+ arr f = id { actionFunction = \x -> return (f x) }
103+
104+ first x = RenderAction
105+ { actionDependencies = actionDependencies x
106+ , actionUrl = actionUrl x
107+ , actionFunction = \(y, z) -> do y' <- (actionFunction x) y
108+ return (y', z)
109+ }