On Mon, Jan 9, 2017 at 1:32 PM, Richard Eisenberg <r...@cs.brynmawr.edu> wrote:

> 2. Defaulting to the implementation written in the class (or `error
> "undefined method"` in the absence of a default. This is essentially the
> default default.)

I want to be able to specify that a certain default definition is good
enough not to worry about. For example (with horribly bad syntax),

class Applicative m => Monad m where
  (>>=) :: m a -> (a -> m b) -> m b
  m >>= f = join (f <$> m)  -- plain old default

  join :: m (m a) -> m a
  good_enough_default join = (>>= id)

This would allow users to just write

newtype Foo a = Foo ... deriving Monad

which would then be equivalent (using the notation you came up with) to

instance Monad Foo where
  deriving newtype (>>=)

David Feuer
_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users

Reply via email to