From: Mart Lubbers Date: Wed, 23 Aug 2017 09:25:49 +0000 (+0200) Subject: edsl X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=c1f07be29a8ca98f14f16ccdc8856de409ade1ce;p=msc-thesis1617.git edsl --- diff --git a/pres.mtask.tex b/pres.mtask.tex index 52115ae..d5e24d2 100644 --- a/pres.mtask.tex +++ b/pres.mtask.tex @@ -146,112 +146,112 @@ instance intArith PrettyPrinter where \end{frame} \subsection{mTask} -\begin{frame} - \frametitle{mTask} - \pause{} - \begin{block}{What is mTask} - \begin{itemize} - \item Created by Pieter Koopman and Rinus Plasmeijer - \item EDSL for imperative programs - \item Arduino C++ generation, iTasks simulation - \end{itemize} - \end{block} - - \begin{block}{Considerations} - \begin{itemize} - \item Type safe - \item Embedded in Clean - \item Extendable - \end{itemize} - \end{block} -\end{frame} - -\begin{frame}[fragile] - \frametitle{Expressions} - \begin{block}{mTask} - Of the form \CI{v t p} - \end{block} - \pause{} - \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 & ... - ... -class boolExpr v where - Not :: (v Bool p) -> v Bool Expr | ... - (&.) infixr 3 :: (v Bool p) (v Bool q) -> v Bool Expr | ... - ... - (==.) infix 4 :: (v a p) (v a q) -> v Bool Expr | ... - \end{lstlisting} -\end{frame} - -\begin{frame}[fragile] - \frametitle{Control flow} - \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 | ... - -class seq v where - (:.) infixr 0 :: (v t p) (v u q) -> v u Stmt | ... - \end{lstlisting} -\end{frame} - -\begin{frame}[fragile] - \frametitle{Assignment and Input/Output} - \begin{lstlisting}[language=Clean] -:: DigitalPin = D0 | D1 | D2 ... -:: AnalogPin = A0 | A1 | A2 ... - -class dIO v where dIO :: DigitalPin -> v Bool Upd -class aIO v where aIO :: AnalogPin -> v Int Upd - -class analogRead v where - analogRead :: AnalogPin -> v Int Expr - analogWrite :: AnalogPin (v Int p) -> v Int Expr - -class digitalRead v where - digitalRead :: DigitalPin -> v Bin Expr - digitalWrite :: DigitalPin (v Bool p) -> v Int Expr - \end{lstlisting} -\end{frame} - -\begin{frame}[fragile] - \frametitle{Shared Data Sources and Assignment} - \begin{lstlisting}[language=Clean] -:: In a b = In infix 0 a b -:: Main a = {main :: a} - -class sds v where - sds :: ((v t Upd)->In t (Main (v c s))) -> (Main (v c s)) | ... - -class assign v where - (=.) infixr 2 :: (v t Upd) (v t p) -> v t Expr | ... - \end{lstlisting} -\end{frame} - - -\begin{frame}[fragile] - \frametitle{Tasks and Examples} - \begin{lstlisting}[language=Clean] -class mtask v a where - task :: (((v delay r) a -> v MTask Expr) -> In (a->v u p) (Main (v t q))) - -> Main (v t q) | ... - \end{lstlisting} - \pause{} - \begin{lstlisting}[language=Clean] -blink = task \blink=(\x. - IF x - (ledOn LED1) - (ledOff LED2) :. - blink (lit 1000) (Not x)) - In {main=blink (lit 1000) True} - -thermostat :: Main (View () Stmt) -thermostat = {main = digitalWrite (dIO D0) (analogRead A0 >. lit 50) - -thermostat2 :: Main (View () Stmt) -thermostat = {main = (dIO D0) =. (analogRead A0 >. lit 50) - \end{lstlisting} -\end{frame} +%\begin{frame} +% \frametitle{mTask} +% \pause{} +% \begin{block}{What is mTask} +% \begin{itemize} +% \item Created by Pieter Koopman and Rinus Plasmeijer +% \item EDSL for imperative programs +% \item Arduino C++ generation, iTasks simulation +% \end{itemize} +% \end{block} +% +% \begin{block}{Considerations} +% \begin{itemize} +% \item Type safe +% \item Embedded in Clean +% \item Extendable +% \end{itemize} +% \end{block} +%\end{frame} +% +%\begin{frame}[fragile] +% \frametitle{Expressions} +% \begin{block}{mTask} +% Of the form \CI{v t p} +% \end{block} +% \pause{} +% \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 & ... +% ... +%class boolExpr v where +% Not :: (v Bool p) -> v Bool Expr | ... +% (&.) infixr 3 :: (v Bool p) (v Bool q) -> v Bool Expr | ... +% ... +% (==.) infix 4 :: (v a p) (v a q) -> v Bool Expr | ... +% \end{lstlisting} +%\end{frame} +% +%\begin{frame}[fragile] +% \frametitle{Control flow} +% \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 | ... +% +%class seq v where +% (:.) infixr 0 :: (v t p) (v u q) -> v u Stmt | ... +% \end{lstlisting} +%\end{frame} +% +%\begin{frame}[fragile] +% \frametitle{Assignment and Input/Output} +% \begin{lstlisting}[language=Clean] +%:: DigitalPin = D0 | D1 | D2 ... +%:: AnalogPin = A0 | A1 | A2 ... +% +%class dIO v where dIO :: DigitalPin -> v Bool Upd +%class aIO v where aIO :: AnalogPin -> v Int Upd +% +%class analogRead v where +% analogRead :: AnalogPin -> v Int Expr +% analogWrite :: AnalogPin (v Int p) -> v Int Expr +% +%class digitalRead v where +% digitalRead :: DigitalPin -> v Bin Expr +% digitalWrite :: DigitalPin (v Bool p) -> v Int Expr +% \end{lstlisting} +%\end{frame} +% +%\begin{frame}[fragile] +% \frametitle{Shared Data Sources and Assignment} +% \begin{lstlisting}[language=Clean] +%:: In a b = In infix 0 a b +%:: Main a = {main :: a} +% +%class sds v where +% sds :: ((v t Upd)->In t (Main (v c s))) -> (Main (v c s)) | ... +% +%class assign v where +% (=.) infixr 2 :: (v t Upd) (v t p) -> v t Expr | ... +% \end{lstlisting} +%\end{frame} +% +% +%\begin{frame}[fragile] +% \frametitle{Tasks and Examples} +% \begin{lstlisting}[language=Clean] +%class mtask v a where +% task :: (((v delay r) a -> v MTask Expr) -> In (a->v u p) (Main (v t q))) +% -> Main (v t q) | ... +% \end{lstlisting} +% \pause{} +% \begin{lstlisting}[language=Clean] +%blink = task \blink=(\x. +% IF x +% (ledOn LED1) +% (ledOff LED2) :. +% blink (lit 1000) (Not x)) +% In {main=blink (lit 1000) True} +% +%thermostat :: Main (View () Stmt) +%thermostat = {main = digitalWrite (dIO D0) (analogRead A0 >. lit 50) +% +%thermostat2 :: Main (View () Stmt) +%thermostat = {main = (dIO D0) =. (analogRead A0 >. lit 50) +% \end{lstlisting} +%\end{frame}