Constrained Type Families?

Edward Kmett ekmett at gmail.com
Wed Mar 9 21:07:53 UTC 2016


Good point!

On Wed, Mar 9, 2016 at 11:48 AM, Ryan Ingram <ryani.spam at gmail.com> wrote:

> 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
> declarations
>
> and
>
> 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: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20160309/d610b8e5/attachment.html>


More information about the ghc-devs mailing list