diff options
author | Jasper Van der Jeugt <m@jaspervdj.be> | 2012-11-10 13:26:39 +0100 |
---|---|---|
committer | Jasper Van der Jeugt <m@jaspervdj.be> | 2012-11-10 13:26:39 +0100 |
commit | 6b11cba1ef50892adf6a9f45e1f21c8da79b7858 (patch) | |
tree | b5e6922b257977fc368efee7ad561b21086caa1e /src/Hakyll/Web/Template | |
parent | 4cb6f9241435fae7a23a7f9fbbdab99e65285eff (diff) | |
download | hakyll-6b11cba1ef50892adf6a9f45e1f21c8da79b7858.tar.gz |
Context module?
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 |