Functor => Pointed => Applicative => Monad

Isaac Dupree ml at isaac.cedarswampstudios.org
Mon Nov 29 17:26:34 CET 2010


On 11/29/10 03:39, John Smith wrote:
> Is there any intention to reorganise the standard class hierarchy,
> arranging them logically instead of in order of invention? I plagiarised
> the following example from
> http://stackoverflow.com/questions/1634911/can-liftm-differ-from-lifta
> and Trac:
>
> class Functor f where
> map :: (a -> b) -> f a -> f b
>
> class Functor f => Pointed f where
> pure :: a -> f a

Is it useful to have Pointed non-Functors?  (I.e. not superclass).  Er, 
Data.Set is the only example I've come up with (its 'singleton' doesn't 
require Ord on elements but its 'map' does).  Then you'd have things like

class (Pointed f, Functor f) => Applicative f where

Cons: Pointed doesn't have any laws without Functor
Pros: (pure) might be useful to use generically by itself

-Isaac




More information about the Libraries mailing list