Constrained Type Families?

Ryan Ingram ryani.spam at
Wed Mar 9 16:48:31 UTC 2016

I think it's more like the non-keyworded default definitions of class
methods, for the same reasons; the default definition has to potentially be
valid for all instances of the class​.

It's the difference between

class Applicative m => Monad m where
    return :: a -> m a
    return = pure  -- always valid, but can be overridden in instance


class Fuctor f => Applicative f where
    (<*>) :: f (a -> b) -> f a -> f b
    default (<*>) :: Monad f => f (a -> b) -> f a -> f b
    (<*>) = ap -- only valid if matches the type signature above
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the ghc-devs mailing list