2 Oct 2012 09:55
Copying a syntax tree
Sergey Mironov <ierton <at> gmail.com>
2012-10-02 07:55:22 GMT
2012-10-02 07:55:22 GMT
Hi! I have a syntax tree defined like this: > > data A a = A Int Int (B a) > > data B a = B String String (C a) > > data C a = C Int Int (D a) > and so on, all the data are parametrized with a type variable. This variable is actually used as a field in the very end of a hierarchy: > > data D a = D Int a > Now I have to write a function which would copy (A Int) to (A String). Is it possible to do so using TH/syb without writing copyA (A i1 i2 b) = A i1 i2 (copyB b) copyB = ... copyC = ... .. copyD (D i a) = D i (show a) ? Could you provide me with a hint? Thanks,(Continue reading)
RSS Feed