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

Henning Thielemann lemming at henning-thielemann.de
Wed Apr 9 09:23:55 EDT 2008


On Wed, 9 Apr 2008, Hans Aberg wrote:

> I don't know if it is possible to extend the syntax this way, but it would be 
> closer to math usage. And one would avoid duplicate definitions just to 
> indicate different operator names, like:
> class AdditiveMonoid a where
>   o :: a
>   (+) :: a -> a -> a
> as it could be create using
> class Monoid (a; o, (+))

I also recognized that problem in the past, but didn't know how to solve 
it. In Haskell 98, methods are resolved using the types of the operands. 
How would the compiler find out which implementation of (+) to choose for 
an expression like x+y using your approach?


More information about the Haskell-Cafe mailing list