[Haskell] PROPOSAL: class aliases

John Meacham john at repetae.net
Wed Oct 12 20:35:56 EDT 2005


On Thu, Oct 13, 2005 at 01:14:19AM +0100, Philippa Cowderoy wrote:
> On Wed, 12 Oct 2005, John Meacham wrote:
> 
> >ideally we would want to split it up like so (but with more mathematically
> >precise names):
> >
> 
> Might it also be reasonable to provide less mathematical names for some 
> classes, and possibly allow users to let the compiler know which ones they 
> find more readable? A lot of users would find Mappable more intuitive than 
> Functor for example, and the improved error messages might make it more 
> practical to call fmap map again.

class aliases help this too :)

class alias Functor m => Mappable m

oh.. or 

class alias (Monad m, Functor m) => Monad' m where
        fmap = liftM

now you can just change your 
instance Monad to instance Monad' and you get your functor instance for
free..

I hadn't thought about that one. (which has bugged me a lot before)
        John

-- 
John Meacham - ⑆repetae.net⑆john⑈ 


More information about the Haskell mailing list