Alternative instance for Const

chessai . chessai1996 at
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: <>

More information about the Libraries mailing list