diff --git a/README.org b/README.org index 805064c..2f07953 100644 --- a/README.org +++ b/README.org @@ -8,7 +8,7 @@ The main idea is to reuse existing libraries that will provide the target langu For instance, this is how you could define an if/else expansion with ~Ondim~: #+begin_src haskell -ifElse :: (Monad m, OndimNode t) => Bool -> Expansion m t +ifElse :: (OndimNode t) => Bool -> Expansion s t ifElse cond node = do let els = children node yes = filter ((Just "else" /=) . identify) els @@ -20,10 +20,10 @@ ifElse cond node = do else expandSubs no #+end_src -Now, suppose you have a variable ~isCat :: Bool~ and you want your templates to choose between two snippets depending on its value. Such HTML template could have type ~[HtmlNode]~, so that if you "lift" it into the Ondim monad binding ~ifElse isCat~ to the name ~if-cat~, +Now, suppose you have a variable ~isCat :: Bool~ and you want your templates to choose between two snippets depending on its value. Such HTML template could have type ~[HtmlNode]~, so that if you expand it while binding ~ifElse isCat~ to the name ~if-cat~, #+begin_src haskell -liftNodes myTemplateContent +expandNode myTemplateContent `binding` do "if-cat" #* ifElse isCat #+end_src @@ -41,7 +41,7 @@ you can now write in your HTML templates... ...and the output will depend on the value of ~isCat~. -The beauty of ondim (and one aspect that takes it further from Heist) is that the ~ifElse~ splice is polymorphic on the format type, so the same code works for formats other than HTML. If you want to template JSON, the same code above would work if src_haskell{myTemplateContent} had type src_haskell{[Value]}, and a similar template could be written as: +The beauty of ondim (and one aspect that takes it further from Heist) is that the ~ifElse~ splice is polymorphic on the format type, so the same code works for formats other than HTML. If you want to template JSON, the same code above would work if ~myTemplateContent~ had type ~[Value]~, and a similar template could be written as: #+begin_src yaml - $: if-cat $children: