[nhc-bugs] No default for MutualRecursion.PP
Christian Maeder
maeder at tzi.de
Tue Jun 7 13:44:17 EDT 2005
Hi,
The program below is accepted by "ghc -fno-monomorphism-restriction" and
"hugs +98". Why can't nhc98 (v1.18) handle it?
Tossing in something like:
instance PP ()
default (())
looks a bit stupid in order to become "portable", doesn't it?
If I replace PP by Show (and pp by show and omit the class declaration)
nhc98 has no problem. Also if I replace one occurrence of fA or fB
directly with pp it goes through.
Cheers Christian
> hmake -nhc98 MutualRekursion.hs
nhc98 -c -o MutualRekursion.o MutualRekursion.hs
====== Errors after type inference/checking:
No default for MutualRecursion.PP at 23:1-24:18.(174,[(148,187)])
No default for MutualRecursion.PP at 19:1-20:18.(183,[(148,186)])
-- --------------------------------------------------------------------
module MutualRecursion where
data A a = A a | BasA (B a)
data B a = B a | AasB (A a)
class PP a where
pp :: a -> String
instance PP a => PP (A a) where
pp (A a) = pp a
pp (BasA b) = pp b
instance PP a => PP (B a) where
pp (B a) = pp a
pp (AasB b) = pp b
fA :: PP a => A a -> String
fA (A a) = pp a
fA (BasA b) = fB b
fB :: PP a => B a -> String
fB (B b) = pp b
fB (AasB a) = fA a
More information about the Nhc-bugs
mailing list