[Haskell-cafe] AMP - how do you motivate this in teaching?

Joachim Breitner mail at joachim-breitner.de
Fri Nov 20 12:33:45 UTC 2015


Am Freitag, den 20.11.2015, 22:20 +1000 schrieb Tony Morris:
> It's a pretty nice example of further splitting of the type-class
> hierarchy, since if given,
> instance Monoid a => Applicative (Either a) where
>   -- we gather all the errors
> then we could not have Either (NonEmpty err), since (NonEmpty err)
> does not have a Monoid, only a binary, associative operation
> (Semigroup)

I believe that there are plans to move Semigroup into Base. Eventually,
there will be a transition to Monoid having Semigroup as a superclass¹,
and I guess then the instance can be changed to 
    instance Monoid a => Applicative (Either a) where
and that worry is gone.


¹ https://ghc.haskell.org/trac/ghc/ticket/10365 and

Joachim “nomeata” Breitner
  mail at joachim-breitner.dehttp://www.joachim-breitner.de/
  Jabber: nomeata at joachim-breitner.de  • GPG-Key: 0xF0FBF51F
  Debian Developer: nomeata at debian.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20151120/7b772512/attachment.sig>

More information about the Haskell-Cafe mailing list