From f0af2a3b79ea7eea3f521f79fd903f9023ec85df Mon Sep 17 00:00:00 2001 From: Jasper Van der Jeugt Date: Tue, 13 Nov 2012 17:31:03 +0100 Subject: WIP --- src/Hakyll/Web/Template/Context.hs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src/Hakyll/Web/Template') diff --git a/src/Hakyll/Web/Template/Context.hs b/src/Hakyll/Web/Template/Context.hs index 4273b79..6261a09 100644 --- a/src/Hakyll/Web/Template/Context.hs +++ b/src/Hakyll/Web/Template/Context.hs @@ -26,16 +26,14 @@ import Hakyll.Web.Urls -------------------------------------------------------------------------------- -type Context a = Compiler (String, (Identifier a, a)) String +type Context a = String -> Identifier -> a -> Compiler String -------------------------------------------------------------------------------- -field :: String -> Compiler (Identifier a, a) String -> Context a -field key value = arr checkKey >>> (empty ||| value) - where - checkKey (k, x) - | k /= key = Left () - | otherwise = Right x +field :: String -> (Identifier -> a -> Compiler String) -> Context a +field key value k' id' x + | k' == key = value id' x + | otherwise = empty -------------------------------------------------------------------------------- @@ -51,7 +49,7 @@ defaultContext = -------------------------------------------------------------------------------- bodyField :: String -> Context Page -bodyField key = field key $ arr snd +bodyField key = field key $ \_ x -> return x -------------------------------------------------------------------------------- -- cgit v1.2.3