Hi,

look at the following example:


module Main where

data A = A
instance Show A

main = do print A


This program does not work, it just loops eating all the heap
(ghc-4.08-1). With respect to the Haskell 98 Report (4.3.2), this
behaviour is ok. ("If no binding is given for some class method then the
corresponding default class method in the class declaration is used (if
present); if such a default does not exist then the class method of this
instance is bound to undefined and no compile-time error results.")
However, the looping behaviour is not very helpful. Why not print a
message like "Calling undefined class method type.class.method"?

(In my eyes, the rule cited above is nonsense. This default behaviour is
not intuitive. Why not derive the standard instances? In a large
project, each module may need its own instances. Some modules require
special stuff, for others the default instances might be sufficient. For
the latter modules, it would be *very helpful* to have some means to
derive the standard instances. AFAIK, ghc-4.06 did it the way I like it,
but in ghc-4.07 this was changed and all my programs were broken. Is
there any reason for doing it the way prescribed by the Haskell Report?)

Michael




Reply via email to