Haskell 98 - Standard Prelude - Floating Class
Marcin 'Qrczak' Kowalczyk
16 Oct 2001 16:27:46 GMT
Tue, 16 Oct 2001 15:29:36 +1000, Fergus Henderson <[email protected]> pisze:
> Not giving a default definition is *not* the same as giving a default
> definition that calls "error". It's significantly safer. The difference
> is that the former makes it much easier for compilers to issue warnings
> when you forget to define a class method in an instance declaration.
There are no warnings when default definitions are expressed in
terms of themselves such that when no explicit definition is present,
they will diverge.
In practice this is analogous to not having a definition at all.
But the compiler sees this as if they had a good definition.
If we are serious about ensuring that definitions are not omitted,
we should handle this case too. It can be done with a pragma which
tells the compiler and a programmer who wants to make instances what
are possible sets of methods to be provided by instances (in terms
of conjunctions and alternatives). This is often already specified
An optimizing compiler could detect most of such "incomplete" instances
itself, with the help of strictness analysis.
__("< Marcin Kowalczyk * [email protected] http://qrczak.ids.net.pl/
^^ SYGNATURA ZASTĘPCZA