update presentation, the body is there
[msc-thesis1617.git] / pres.mtask.tex
index ef80aaf..49a275f 100644 (file)
@@ -10,6 +10,8 @@
                \item Language in a language
                \item Use the properties of the host
                \item E.g., Ivory, \ldots\pause{} and iTasks
+               \pause{}
+               \item Different embedding techniques
        \end{itemize}
 \end{frame}
 
@@ -25,7 +27,7 @@
                \end{block}
                \column{.49\textwidth}
                \pause{}
-               \begin{lstlisting}
+               \begin{lstlisting}[language=Clean]
 :: DSL = LitI  Int     | LitB  Bool
        | Var   String  | Plus  DSL DSL
        | Minus DSL DSL | And   DSL DSL
@@ -58,7 +60,7 @@ pprint :: DSL -> String
                \end{block}
                \pause{}
                \column{.49\textwidth}
-               \begin{lstlisting}
+               \begin{lstlisting}[language=Clean]
 :: Env   = ...
 :: DSL a = DSL (Env -> a)
 
@@ -105,7 +107,7 @@ Plus x y = \e -> x e + y e
                }
                \column{.49\textwidth}
                \begin{onlyenv}<2->
-                       \begin{lstlisting}
+                       \begin{lstlisting}[language=Clean]
 :: Env   = ...
 :: Evaluator a = Evaluator (Env -> a)
 :: PrettyPrinter a = PP String
@@ -137,7 +139,8 @@ instance intArith PrettyPrinter where
        \pause{}
        \begin{block}{What is mTask}
                \begin{itemize}
-                       \item EDSL
+                       \item Created by Pieter Koopman and Rinus Plasmeijer
+                       \item EDSL for imperative programs
                        \item Arduino C++ generation, iTasks simulation
                \end{itemize}
        \end{block}
@@ -154,17 +157,14 @@ instance intArith PrettyPrinter where
 \begin{frame}[fragile]
        \frametitle{Expressions}
        \begin{block}{mTask}
-               \begin{itemize}
-                       \item Two phantom types
-                       \item Hierarchy
-               \end{itemize}
+               Of the form \CI{v t p}
        \end{block}
        \pause{}
-       \begin{lstlisting}
+       \begin{lstlisting}[language=Clean]
 class arith v where
   lit           :: t -> v t Expr
-  (+.) infixl 6 :: (v t p) (v t q) -> v t Expr          | +, zero t    & isExpr p & isExpr q
-  (-.) infixl 6 :: (v t p) (v t q) -> v t Expr          | -, zero t    & ...
+  (+.) infixl 6 :: (v t p) (v t q) -> v t Expr | +, zero t & isExpr p & isExpr q
+  (-.) infixl 6 :: (v t p) (v t q) -> v t Expr | -, zero t & ...
   ...
 class boolExpr v where
   Not           :: (v Bool p) -> v Bool Expr            | ...
@@ -176,19 +176,11 @@ class boolExpr v where
 
 \begin{frame}[fragile]
        \frametitle{Control flow}
-       \begin{lstlisting}
-class If v q r ~s where
-  If :: (v Bool p) (v t q) (v t r) -> v t s | ...
-
+       \begin{lstlisting}[language=Clean]
 class IF v where
   IF :: (v Bool p) (v t q) (v s r) -> v () Stmt | ...
   (?) infix 1 :: (v Bool p) (v t q) -> v () Stmt | ...
 
-instance If Code Stmt Stmt Stmt
-instance If Code e    Stmt Stmt
-instance If Code Stmt e    Stmt
-instance If Code x    y    Expr
-
 class seq v where
   (:.) infixr 0 :: (v t p) (v u q) -> v u Stmt | ...
        \end{lstlisting}
@@ -196,7 +188,7 @@ class seq v where
 
 \begin{frame}[fragile]
        \frametitle{Assignment and Input/Output}
-       \begin{lstlisting}
+       \begin{lstlisting}[language=Clean]
 :: DigitalPin = D0 | D1 | D2 ...
 :: AnalogPin  = A0 | A1 | A2 ...
 
@@ -215,7 +207,7 @@ class digitalRead v where
 
 \begin{frame}[fragile]
        \frametitle{Shared Data Sources and Assignment}
-       \begin{lstlisting}
+       \begin{lstlisting}[language=Clean]
 :: In a b = In infix 0 a b
 :: Main a = {main :: a}
 
@@ -229,26 +221,18 @@ class assign v where
 
 \begin{frame}[fragile]
        \frametitle{Examples}
-       \begin{lstlisting}
+       \begin{lstlisting}[language=Clean]
 blink = task \blink=(\x.
-            IF (x ==. lit True)
-               (ledOn led)
-               (ledOff led) :.
+            IF x)
+               (ledOn LED1)
+               (ledOff LED2) :.
             blink (lit 1000) (Not x))
         In {main=blink (lit 1000) True}
 
 thermostat :: Main (View () Stmt)
-thermostat = {main = IF (analogRead A0 >. lit 50)
-                        ( digitalWrite D0 (lit True)  )
-                        ( digitalWrite D0 (lit False) )
-             }
+thermostat = {main = digitalWrite (dIO D0) (analogRead A0 >. lit 50)
 
 thermostat2 :: Main (View () Stmt)
-thermostat2 = let a0 = aIO A0
-                  d0 = dIO D0
-              in {main = IF (a0 >. lit 50)
-                            (d0 =. lit True)
-                            (d0 =. lit False)
-              }
+thermostat = {main = (dIO D0) =. (analogRead A0 >. lit 50)
        \end{lstlisting}
 \end{frame}