[Haskell] The FunctorM library

John Meacham john at repetae.net
Thu Mar 24 01:13:25 EST 2005


On Wed, Mar 23, 2005 at 11:29:51PM -0500, Cale Gibbard wrote:
> I agree, and think that's a great idea for solving that problem.
> Does anyone see any possible difficulties with it?
> I think that perhaps specifying the entire instance might make more sense, eg:
> 
> class Functor m => Monad m where
>     {- ... usual stuff ... -}
>     instance Functor m where
>         fmap = liftM
> 
> Having such a thing seems quite useful. As long as it doesn't break
> the world, I'd personally like to have this feature.
> 
> One issue might be which default instance gets chosen when two classes
> both provide default instances for a given class. Perhaps in this
> case, we can just force the user to provide an instance, or produce a
> compile-time warning and select one automatically in some canonical
> fashion.
> 
> What do the Simons think?

This was brought up before, a problem is that an 'import' can silently
change behavior, because depending on whether an existing Functor
instance is already in scope, a Monad instance will either create one or
not. 
        John

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


More information about the Haskell mailing list