Proposal for stand-alone deriving declarations?

Malcolm Wallace Malcolm.Wallace at cs.york.ac.uk
Wed Nov 1 16:46:43 EST 2006


"Brian Smith" <brianlsmith at gmail.com> writes:

> >         http://haskell.org/haskellwiki/GHC/StandAloneDeriving
> 
> Basically, the syntax
> for instances and derived instances would be identical, but derived
> instances would just omit the "where" clause, while non-derived instances
> would need the "where" clause.

This is a really _bad_ idea for readability.  In a year's time, when
this discussion is forgotten, who would be able to tell at a glance the
deep and real semantic difference between the following two instance
decls?

    instance Num (Bar z) where
and 
    instance Num (Bar z)

The former declares that _no_ methods are defined (except for defaults),
and the latter, with your proposal, that _all_ methods are defined.  The
real killer is that both of these decls are already valid in Haskell'98,
but they mean the _same_ thing (the former, if you were wondering).

This is a sure recipe for introducing new and subtle bugs into existing
bug-free programs.

Regards,
    Malcolm


More information about the Haskell-prime mailing list