[Haskell-cafe] instance Monad m => Functor m

Henning Thielemann lemming at henning-thielemann.de
Wed Apr 9 10:26:32 EDT 2008

On Wed, 9 Apr 2008, Hans Aberg wrote:

> Different names result in different operator hierarchies. So a class like
> class Monoid (a; unit, mult) where
>   unit :: a
>   mult :: a -> a -> a
> must have an instantiation that specifies the names of the operators. In 
> particular, one will need a
> class (Monoid (a; 0; (+)), ...) => Num a ...
> if (+) should be used as Monoid.(+) together with Num.(+).
> Or give an example you think may cause problems, and I will give it a try.

I think a classical example are number sequences which can be considered 
as rings in two ways:
  1. elementwise multiplication
  2. convolution

and you have some function which invokes the ring multiplication

f :: Ring a => a -> a

and a concrete sequence

x :: Sequence Integer

what multiplication (elementwise or convolution) shall be used for 
computing (f x) ?

More information about the Haskell-Cafe mailing list