hakyll/src/Hakyll/Web/Template/Context.hs
Jasper Van der Jeugt 6b11cba1ef Context module?
2012-11-10 13:26:39 +01:00

24 lines
752 B
Haskell

--------------------------------------------------------------------------------
module Hakyll.Web.Template.Context
( Context
, field
) where
--------------------------------------------------------------------------------
import Control.Applicative (empty)
import Control.Arrow
import Hakyll.Core.Compiler
--------------------------------------------------------------------------------
type Context a = Compiler (String, a) String
--------------------------------------------------------------------------------
field :: String -> Compiler a String -> Context a
field key value = arr checkKey >>> empty ||| value
where
checkKey (k, x)
| k == key = Left ()
| otherwise = Right x