|
Re: no non-typevariable in instance declarations: msg#00053lang.haskell.general
On Tue, Nov 14, 2000 at 05:02:30PM +0000, Malcolm Wallace wrote: > > class C a where > > ty :: a -> String > > instance (Num a) => C a where > > ty _ = "NUM" > > instance C Integer where > > ty _ = "Integer" > > > Why GHC and NHC98 are more restrictive than Hugs? > > The instances for (Num a=> a) and Integer overlap, and are therefore > forbidden by Haskell'98. But this is not relevant to my question. Removing the instance declaration instance C Integer where ty _ = "Integer" from the program (so that there is no instance overlapping now) does not help. Both GHC and NHC98 still complains with the same diagnostics as before. They are not accepting the instance declaration instance (Num a) => C a where ty _ = "NUM" because there is no non-type-variable component in the instantiated type "a" above. Again, why they have this restrictions while Hugs has not? > Hugs allows overlapping instances. When given the option +o > So does GHC with a special flag (-foverlapping-instances I think). Yes > nhc98 does not provide type-system extensions to Haskell'98. Not exactly. NHC98 provides at least the following extension to Haskell 98: * existentialy quantified type variables (By the way, is there any plans to implement multiparameter type classes and instance overlapping in NHC98?) Thanks, Romildo -- Prof. José Romildo Malaquias <romildo@xxxxxxxxxxxx> Departamento de Computação Universidade Federal de Ouro Preto Brasil |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: no non-typevariable in instance declarations: 00053, Malcolm Wallace |
|---|---|
| Next by Date: | Haskell T-Shirt Contest: 00053, John Peterson |
| Previous by Thread: | Re: no non-typevariable in instance declarationsi: 00053, Malcolm Wallace |
| Next by Thread: | Re: no non-typevariable in instance declarations: 00053, Marcin 'Qrczak' Kowalczyk |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |