on master help sign in
Explode when using mapContext over ListField
commitfaa90283bfdd13740ebecd91c3f966591d183d79 authorJasper Van der Jeugt <m@jaspervdj.be> dateTue 13 Aug 2013, 01:38 (13 years ago) parent0b11106
1 file changed+5−3
src/Hakyll/Web/Template/Context.hs+5−3
src/Hakyll/Web/Template/Context.hs+5−3
@@ -100,9 +100,11 @@ functionField name value = Context $ \k i -> case words k of
100100mapContext :: (String -> String) -> Context a -> Context a
101101mapContext f (Context c) = Context $ \k i -> do
102102 fld <- c k i
103− return $ case fld of
104− StringField str -> StringField (f str)
105− ListField ctx is -> ListField ctx is
103+ case fld of
104+ StringField str -> return $ StringField (f str)
105+ ListField _ _ -> fail $
106+ "Hakyll.Web.Template.Context.mapContext: " ++
107+ "can't map over a ListField!"
106108
107109
108110--------------------------------------------------------------------------------