From 704eeeaf0bca65cd58c50a432422322e0c2854c6 Mon Sep 17 00:00:00 2001 From: thma Date: Sat, 29 Dec 2018 17:04:55 +0100 Subject: [PATCH] continue interpreter section --- LtuPatternFactory.cabal | 2 ++ README.md | 5 +++++ src/Main.hs | 2 ++ 3 files changed, 9 insertions(+) diff --git a/LtuPatternFactory.cabal b/LtuPatternFactory.cabal index cb11c70..482a9d4 100644 --- a/LtuPatternFactory.cabal +++ b/LtuPatternFactory.cabal @@ -29,6 +29,7 @@ executable LtuPatternFactory , Visitor , Coerce , IdiomBrackets + , Interpreter , DependencyInjection , CheapskateRenderer , CMarkGFMRenderer @@ -63,6 +64,7 @@ test-suite LtuPatternFactory-Demo , Visitor , Coerce , IdiomBrackets + , Interpreter , DependencyInjection , CheapskateRenderer , CMarkGFMRenderer diff --git a/README.md b/README.md index 90dc784..fe18860 100644 --- a/README.md +++ b/README.md @@ -785,6 +785,11 @@ eval (Let x e1 e2) = eval e1 >>= \v -> local ((x,v):) (eval e2) [to be continued] +This section was inspired by ideas presented in [Quick Interpreters with the Reader Monad](https://donsbot.wordpress.com/2006/12/11/quick-interpreters-with-the-reader-monad/). + +[Sourcecode for this section](https://github.com/thma/LtuPatternFactory/blob/master/src/Interpreter.hs) + + ### Composite → SemiGroup → Monoid >In software engineering, the composite pattern is a partitioning design pattern. The composite pattern describes a group of objects that is treated the same way as a single instance of the same type of object. The intent of a composite is to "compose" objects into tree structures to represent part-whole hierarchies. Implementing the composite pattern lets clients treat individual objects and compositions uniformly. diff --git a/src/Main.hs b/src/Main.hs index 94b9ff7..f588c9d 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -13,6 +13,7 @@ import Singleton import Strategy import TemplateMethod import Visitor +import Interpreter main :: IO () main = do @@ -30,3 +31,4 @@ main = do abstractFactoryDemo jsonPersistenceDemo demoDI + interpreterDemo