eval (Lit i) = i
eval (Plus l r) = case (eval l, eval r) of
(Lit (I l), Lit (I r)) -> I (l+r))
- (l, r) -> error $ "Cannot add " ++ show l ++ " to " ++ show r
+ (l, r) -> error ("Can't add " ++ show l ++ " to " ++ show r)
eval (Eq l r) = case (eval l, eval r) of
(Lit (I l), Lit (I r)) -> B (l==r)
(Lit (B l), Lit (B r)) -> B (l==r)
- (l, r) -> error $ "Cannot compare " ++ show l ++ " to " ++ show r
+ (l, r) -> error ("Can't compare " ++ show l ++ " to " ++ show r)
\end{lstHaskell}
Luckily this problem can be overcome by switching from regular \glspl{ADT} to \glspl{GADT}, resulting in the following data type and evaluator.
The first downside of this type of \gls{EDSL} can be overcome by using \glspl{GADT}~\cite{cheney_first-class_2003}.
Example~\ref{lst:exdeepgadt} shows the same language, but type-safe with a \gls{GADT}.
-\glspl{GADT} are not supported in the current version of \gls{CLEAN} and therefore the syntax is hypothetical.
+\glspl{GADT} are not supported in the current version of \gls{CLEAN} and therefore the syntax is hypothetical (See \todo{insert link to appendix}).
However, it has been shown that \glspl{GADT} can be simulated using bimaps or projection pairs~\cite{cheney_first-class_2003}.
Unfortunately the lack of extendability remains a problem.
If a language construct is added, no compile time guarantee can be given that all views support it.
\section{Shallow embedding}
-\subsection{Tagless-final embedding}
+\subsection{Tagless-final embedding}\label{ssec:tagless}
\section{Comparison}