Alternative instance for Const

chessai . chessai1996 at gmail.com
Sat Mar 21 18:44:07 UTC 2020


We already have

instance Monoid m => Applicative (Const m)

we could easily add

instance Monoid m => Alternative (Const m) where
  empty = coerce mempty
  (<|>) = coerce (<>)

which trivially satisfies left/right identity and associativity.

I propose we add this instance to base.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20200321/e0f1d9c6/attachment.html>


More information about the Libraries mailing list