-- In the context of this program Hugs 1.4 printsThis is a "feature" of the function that handles top-level expressions. It infers the type of the expression, and then tries to find a `show' function at that type. The problem is that it isn't applying the `default' rule when trying to find the `show' function itself (defaulting is applied when inferring the top-level expression, but that doesn't help in this case).
-- the expressions
-- Pz
-- tolist Pz
-- as an error (can't find show function) and []
-- respectively. I asked Phil Wadler about it.
-- He was surprised, but referred me to higher
-- authority. Is the behavior correct?
-- If so, why?-- Thanks,
-- Doug McIlroydata Num a => Ps a = Pz
tolist:: Num a => Ps a -> [a]
tolist Pz = []instance Num a => Show (Ps a) where
showsPrec p f = showsPrec p (tolist f)
I'll check a fix into the CVS repository. There's an easy workaround if you don't want to be bothered patching your version of hugs: simply say: `print Pz' instead of just `Pz'.
--Jeff
