Consider:
data Expr a
= V a
| Lit Integer
| Let (Expr a) (Expr (Maybe a))
deriving (Eq,Show)
The Let
constructor enables me to bind an expression (first arg) in order to reference it in the second (V Nothing
refers to it).
If I do something like
Let (Lit 3) $ Let (Lit 1) $ Var Nothing
which Lit
does the Var Nothing
refer to? Furthermore, I’d like to generalize that to
multiple bindings at once, and I have no idea how to do that. I followed some examples from the excellent Edward Kmett bound package, but now I’m both confused and lost.
V (Just Nothing)
doesn’t type check, does it? – Jat