Thread of 2 posts
jump to repliesIs it just me, or is this a weird post by Sandy Maguire?
The Maybe formulation is incorrect -
`unionWith :: (Maybe a -> Maybe b -> c) -> Map k a -> Map k b -> Map k c`
And that the version with `These` is the right one to use -
`unionWith :: (These a b -> c) -> Map k a -> Map k b -> Map k c`
But then Sandy immediately discards this formulation, and instead builds up a monoidal strawman, which is equivalent to the Maybe formulation, to knock down. To get some law that doesn't hold anyway?
https://reasonablypolymorphic.com/blog/api-analysis/
#Haskell
The blog requires a #github login so can't comment on the post itself. Damn #WalledGardens
2 replies
back to top@aj Yeah, I disagree with several assertions in the article, and I don't think a "semigroup homomorphism" is sufficient reason to quash a perfectly reasonable API.
It unreasonably complicates (through additional constraints) the out value for keys not in either input map.