
10 May
2019
10 May
'19
1:13 p.m.
Foldable, Traversable, Bifoldable, and Bitraversable instances of Data.Semigroup.Arg don't respect ==. For example, Arg () 1 == Arg () 2 = True, but sum (Arg () 1) = 1 and sum (Arg () 2) = 2. I believe the best solution is to remove the Traversable and Bitraversable instances, and define foldMap _ _ = mempty bifoldMap f _ (Arg a _) = a There also needs to be some documentation about the fact that the Arg constructor allows inspection that does not respect Eq.