Scalable and Continuous

Marcin 'Qrczak' Kowalczyk
Mon, 12 Feb 2001 12:17:02 +0100 (CET)

On Mon, 12 Feb 2001, Ashley Yakeley wrote:

> class (Additive a) => Scalable a
>      scale :: Real -> a -> a -- equivalent to * (not sure of name for Real type)

Or times, which would require multiparameter classes.
    5 `times` "--" == "----------"
    5 `times` (\x -> x+1) === (\x -> x+5)
But this would suggest separating out Monoid from Additive - ugh. It makes
sense to have zero and (+) for lists and functions a->a, but not negation.
There is a class Monoid for ghc's nonstandard MonadWriter class. We would
have (++) unified with (+) and concat unified with sum.

I'm afraid of making too many small classes. But it would perhaps be not
so bad if one could define superclass' methods in subclasses, so that one
can forget about exact structure of classes and treat a bunch of classes
as a single class if he wishes. It would have to be combined with
compiler-inferred warnings about mutual definitions giving bottoms.

Marcin 'Qrczak' Kowalczyk