X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=methods.dsl.tex;h=f21cb88c6d2773146e6d3cf4864e0d74a55ff92f;hb=fcef9f5c5b6021ac424b19c44b4bda608eceaf40;hp=be8bf7426fc96584b35be4f6c57a4b12acfc0d53;hpb=76254fbf2941fa0b5a02ab3a98104cad56959218;p=msc-thesis1617.git diff --git a/methods.dsl.tex b/methods.dsl.tex index be8bf74..f21cb88 100644 --- a/methods.dsl.tex +++ b/methods.dsl.tex @@ -110,6 +110,9 @@ must be updated accordingly to prevent possible runtime errors. When an extension is added in a new class, this problem does not arise and views can choose to implement only parts of the collection of classes. +In contrast to deep embedding, it is very well possible to have multiple views +applied on the same expression. This is also shown in the following listing. + \begin{lstlisting}[label={lst:exclassshallow},% caption={A minimal class based shallow \gls{EDSL}}] :: Env = ... // Some environment @@ -133,4 +136,15 @@ instance intArith PrettyPrinter where lit x = toString x add x y = x +++ "+" +++ y ... + +... + +Start :: (PP String, Bool) +Start = (print e0, eval e0) +where + e0 :: a Bool | intArith, boolArith a + e0 = eq (lit 42) (lit 21 +. lit 21) + + print (PP p) = p + eval (Evaluator e) env = e env \end{lstlisting}