Re: [Haskell-cafe] Data.Generics question

2006-12-19 Thread Carl Witty
On Tue, 2006-12-19 at 09:25 -0500, Mark T.B. Carroll wrote: > Hmmm. That's interesting. I have a slightly different problem and I > don't know if it's relevant or not. I have nested algebraic data types > for things like expressions with terms and operators and whatever too, > and some of my functi

Re: [Haskell-cafe] Data.Generics question

2006-12-19 Thread Neil Mitchell
Hi Mark, nested type, but to do that I seem to have to create a whole other near-copy of the data declarations with slightly different names and the occasional constructor missing. I wonder if there's a better way. Instead of getting the type system to enforce it, you can write annotations tha

Re: [Haskell-cafe] Data.Generics question

2006-12-19 Thread Mark T.B. Carroll
Hmmm. That's interesting. I have a slightly different problem and I don't know if it's relevant or not. I have nested algebraic data types for things like expressions with terms and operators and whatever too, and some of my functions do a transformation that removes all instances of particular con

Re: [Haskell-cafe] Data.Generics question

2006-12-19 Thread Vyacheslav Akhmechet
Sorry, I sent the email to the wrong place and messed up the code (it's early :)). Take two: transform = everywhere (mkT transform') where transform = (\Term a->Flattened a) `extT` (Contstant a->Flattened a) On 12/19/06, Vyacheslav Akhmechet <[EMAIL PROTECTED]> wrot

[Haskell-cafe] Data.Generics question

2006-12-19 Thread Grote Collective
Hello all, I have two datatypes, both representing the same language. However, one is a "flattened" version of the other. For instance: data Flattened = Const Flattened | Sum Flattened Flattened | ... | IntConst Int | RealConst Float | BoolConst Bool | Void data Term = Const Con