Added Arrow implementation for RenderAction.

This commit is contained in:
Jasper Van der Jeugt 2010-03-09 18:26:53 +01:00
parent 4756b82329
commit 0204dd678a

View file

@ -11,6 +11,7 @@ module Text.Hakyll.RenderAction
, Renderable
) where
import Control.Arrow
import Control.Category
import Control.Monad ((<=<), mplus, unless)
import Control.Monad.Reader (liftIO)
@ -96,3 +97,13 @@ instance Category RenderAction where
, actionUrl = actionUrl y `mplus` actionUrl x
, actionFunction = actionFunction x <=< actionFunction y
}
instance Arrow RenderAction where
arr f = id { actionFunction = \x -> return (f x) }
first x = RenderAction
{ actionDependencies = actionDependencies x
, actionUrl = actionUrl x
, actionFunction = \(y, z) -> do y' <- (actionFunction x) y
return (y', z)
}