You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As documentation explains you can create something out of nothing using mempty, which imposes a Monoid constraint on every field which rules out a whole bunch of useful types.
An alternative would be to impose constraint on functor - Alternative f can provide "something" filled with "nothing"
Aha! There's actually a function in the Barbies library, buniq that does exactly this. I think this could certainly lead to some more useful examples, though I'd agree that Alternative would be a nice addition to the library :)
As documentation explains you can create something out of nothing using
mempty
, which imposes aMonoid
constraint on every field which rules out a whole bunch of useful types.An alternative would be to impose constraint on functor -
Alternative f
can provide "something" filled with "nothing"nofoo
can be for exampleFoo Nothing
orFoo (Left "")
The text was updated successfully, but these errors were encountered: