> When inferring the context for the derived instances, type synonyms must > be expanded out first. > > I don't understand it. Which type synonyms need expansion? All the u_n > are type variables.
I worked it out. Given data cx => T u1 ... uk = K1 t11 ... t1k1 | ...| Kn tn1 ... tnkn deriving C one constructs instance cx' => C (T u1 ... uk) where ... cx' is obtained by reducing the context (cx, C t11, ..., C t1k1, ..., C tn1,... ,C tnkn) Basically this is standard context reduction as performed by type inference, except that in the process the need to reduce the context C (T a1 ... ak) may arise. I assume that the least solution of all possible solutions is used. Can anybody suggest a simple way for computing this least fixpoint? nhc98 doesn't determine the least fixpoint whereas ghc and hbc seem to do so. This is way more complicated then I thought and doesn't encourage me to implement it. Naturally all this is pure guesswork, because the Haskell 98 report doesn't explain anything of this... Olaf -- OLAF CHITIL, Dept. of Computer Science, The University of York, York YO10 5DD, UK. URL: http://www.cs.york.ac.uk/~olaf/ Tel: +44 1904 434756; Fax: +44 1904 432767 _______________________________________________ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
