[Template-haskell] instance declaration issue

Derek Elkins ddarius86@hotmail.com
Wed, 12 Feb 2003 17:58:09 -0500


Generating a set of pattern matched function declarations in an instance 
declaration (see below) causes a "Conflicting definition error" upon 
linking.

instance (G a) => F (Tree a) where
    f (Leaf x) = g x
    f (Branch x y) = g x `h` g y

rewritten as

instance (G a) => F (Tree a) where
    f x = case x of
             Leaf x -> g x
             Branch x y -> g x `h` g y

works.  I suspect that it has to do with the "level" the source code is 
considered.  I.e. the transformation from the above into the below is 
already considered done by the compiler.

The problem (it it's a problem) may be in the way I'm generating the code.  
If you can't get it to happen, I'll email my code.

_________________________________________________________________
Help STOP SPAM with the new MSN 8 and get 2 months FREE*  
http://join.msn.com/?page=features/junkmail