A general question about the use of classes in defining interfaces

Henrik Nilsson nhn at Cs.Nott.AC.UK
Wed Oct 8 08:26:56 EDT 2008

Hi Doaitse, Ross,

Doaitse wrote:

 > The problem which arises now is when I want to use the class
 > Applicative as it is now defined in Control.Applicative. Functions
 > like <$>, <$, <* and many have standard implementations in terms of
 > the basic function pure and <*>. Although this looks fine at first
 > sight, this is not so fine if we want to give more specialised
 > (optimised, checking) implementations, as I am doing in my library.

There used to be the same problem with the Arrow class, with
operators like &&& and *** having standard definitions, but not
being redefineable due to not being class methods, which prevented
(or at least made much more difficult) certain optimizations.

After some prodding from me, Ross moved them into the Arrow class,
with default definitions.

I was and still am quite happy with that, and I'm not aware of
any major drawbacks, except that it might not be so clear
exactly where to draw the line between methods and top-level
standard definitions if one opt to include more than the bare
minimum of methods.



Henrik Nilsson
School of Computer Science
The University of Nottingham
nhn at cs.nott.ac.uk

This message has been checked for viruses but the contents of an attachment
may still contain software viruses, which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.

More information about the Libraries mailing list