diff options
Diffstat (limited to 'src/Hakyll/Web/Template')
-rw-r--r-- | src/Hakyll/Web/Template/Context.hs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/Hakyll/Web/Template/Context.hs b/src/Hakyll/Web/Template/Context.hs new file mode 100644 index 0000000..5ca1556 --- /dev/null +++ b/src/Hakyll/Web/Template/Context.hs @@ -0,0 +1,24 @@ +-------------------------------------------------------------------------------- +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 |