[Template-haskell] Release

Ian Lynagh igloo@earth.li
Tue, 8 Apr 2003 13:17:25 +0100


As I understand it the GHC team are heading towards a release including
TH in the not too distant future. I think it would be good if the
biggest outstanding issues could be fixed before then (and indeed, just
fixed ASAP).

The one that causes me the most hoop jumping is the type parameters to
some of the TH datastructures. For example, I have some code like this:

class ToDec a where
    to_dec :: a -> Dec

instance ToDec Dec where
    to_dec = id

class ToExp a where
    to_exp :: a -> Exp

instance ToExp Exp where
    to_exp = id

instance (ToExp e, ToDec d) => Foo (Match p e d) where
    foo (Mat p (Normal e) ds) = bar (Normal (Let (map to_dec ds) (to_exp e)))

Which I'd much rather be able to write as

instance Foo Match where
    foo (Mat p (Normal e) ds) = bar (Normal (Let (map to_dec ds) (to_exp e)))

Previous discussions about this have all petered out before reaching a
conclusion, but I haven't seen anyone actually stand up and defend the
parameterised types, and it's hard to see how they could be useful
without everything being parameterised anyway. Can we get rid of them?
Please? Or at least have an explanation of why not...

Hmmm, or maybe I should be asking for them to be extended to cover all
the types to make it easier to have a type of reification that annotates
the tree with type and strictness information. I'd still have the
problem above, but at least more things would be possible.

Anyway, I'm confused, but sitting in the middle is just driving me mad!


Thanks
Ian