This is exactly why I prefer Monoid over Semigroup. Having a law-abiding identity eliminates all sorts of corner caseshttps://twitter.com/carnivorous8008/status/871924374567231488 …
-
-
Replying to @GabrielG439
Doesn’t it depend on context? Aren’t there instances where semigroups can also eliminate edge cases? E.g.: Validation (NonEmpty String) a
1 reply 0 retweets 2 likes -
Replying to @stephencelis
I don't have a good answer for the case of Validation
1 reply 0 retweets 0 likes -
Replying to @GabrielG439 @stephencelis
It's the Applicative (Validation e) instance, originally in the paper gives Monoid e => which is problematic, and amended to Semigroup e =>
2 replies 0 retweets 0 likes -
Replying to @dibblego @GabrielG439
Sorry I figured
@GabrielG439 was familiar. It makes me wonder if there is a dual preference for Semigroup for where he prefers Monoid.3 replies 0 retweets 0 likes -
Seems to me that preference shouldn't enter into it. Either that extra state should be representable, or not.
1 reply 1 retweet 1 like -
^ This person agrees. Why can't I use do-notation on (Writer (NonEmptyList x)) in Haskell ? I can even with Scala, and that's Scala!
2 replies 0 retweets 2 likes -
hmm, it would be neat to statically verify that you actually *use* a constraint, but `runWriter (pure ())` seems to forbid a `NonEmpty`
3 replies 0 retweets 0 likes
Recent GHC versions warn of unnecessary constraints.
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.