
It'll have to use the underlying Functor and Applicative to get an Alternative.
Could you give some examples where you'd like to use this?
I don't like the name but don't have a better one off the top of my
head. AltMonoid or something?
On Sat, 16 Feb 2019 at 10:20, theindigamer
I'm not sure which implementation you have in mind - the newtype one? I suppose that it would be harmless to add it in, although I don't immediately see the use case.
On Fri, Feb 15, 2019 at 7:11 PM Carter Schonwald
wrote: this looks quite pretty, though I must admit that im not the most savvy at quantified constraints yet
wouldn't this newtype also benefit from a semigroup and monoid instance too? (or am I overlooking some reason why you can't do them too?)
On Fri, Feb 15, 2019 at 7:05 PM theindigamer
wrote: 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)
_______________________________________________ Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
_______________________________________________ Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries