(This is intended as a simplification of the problem I actually need to solve.)<br><br>I&#39;m trying to implement the lambda calculus (with CBV evaluation) using the &quot;syntactic&quot; package, in such a way that a simple extension is also simple to implement.<br>

<br>I am stuck on the fact that it seems that the Value type needs to be parametrized over the Expr type and I can&#39;t seem to figure out how to do it.<br><br>I&#39;ve read <a href="http://www.haskell.org/pipermail/haskell-cafe/2011-May/091770.html">this post</a> from the archives, but I still seem to be missing something.<br>

<br>Does anyone have any suggestions?<br><br>&gt; -- Lambda calculus<br>&gt; type Ident = String<br>&gt; data Value = VLam Ident Expr<br>&gt; data Expr = Var Ident | Lam Ident Expr | App Expr Expr<br>&gt; eval :: Expr -&gt; Value<br>

&gt; eval e =<br>&gt;   case e of<br clear="all">&gt;     Var _ -&gt; error &quot;not closed&quot;<br>&gt;     Lam i e&#39; -&gt; VLam i e&#39;<br>&gt;     App e1 e2 -&gt;<br>&gt;       case eval e1 of<br>&gt;         Lam i e&#39; -&gt; subst e&#39; (eval e2) i<br>

&gt;         _ -&gt; error &quot;illegal application&quot;<br><br>&gt; -- Lambda calculus with integers and addition<br>&gt; data Value = VLam Ident Expr | VInt Integer<br>&gt; data Expr = Var Ident | Lam Ident Expr | App Expr Expr | Plus Expr Expr<br>

&gt; eval e =<br>&gt;   case e of<br>&gt;     ...<br>&gt;     Plus e1 e2 -&gt;<br>&gt;       case (eval e1, eval e2) of<br>&gt;         (VInt x1, VInt x2) -&gt; VInt $ x1 + x2<br>&gt;         _ -&gt; error &quot;illegal addition&quot;<br>

<br>-- <br><div dir="ltr"><div>          Alex R</div></div><br>