On Sun, Jan 3, 2010 at 8:30 PM, Patrick Caldon <[email protected]> wrote:
> I'm trying to write some template haskell which will transform:
> $(buildCP 0) Âinto \(SimpleM d1 d2 d3) (SimpleM _ _ _) -> (SimpleM d1 d2 d3)
> $(buildCP 1) Âinto \(SimpleM _ d2 d3) (SimpleM d1 _ _) -> (SimpleM d1 d2 d3)
> $(buildCP 1) Âinto \(SimpleM d1 _ d3) (SimpleM _ d2 _) -> (SimpleM d1 d2 d3)
> and so on.
> Ultimately I want to generalize this to more variables.
> I can't seem to get anything to substitute for the pattern variables in a
> lambda. ÂIs there a straightforward way of doing this?
It looks like you want to construct expressions with the LamE
constructor, which is declared like so:
LamE [Pat] Exp
For the Pat, you would use eiter VarP or WildP for variable binding
patterns or wild-card patterns.
Or am I missing something?
Haskell-Cafe mailing list