Add newtype for Alternative using QuantifiedConstraints in base-4.13

theindigamer theindigamer15 at gmail.com
Sat Feb 16 00:04:43 UTC 2019


Thoughts on adding a newtype with the following Alternative instance?

(The name chosen is a placeholder, I don't have any particular preference).

newtype Mon f a = Mon { unMon :: f a }

instance (forall a. Monoid (f a)) => Alternative (Mon f) where
  empty = Mon mempty
  (<|>) (Mon m1) (Mon m2) = Mon (m1 <> m2)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20190215/1c453fe8/attachment.html>


More information about the Libraries mailing list