Monoid over reciprocal of reciprocal sum

Henning Thielemann lemming at henning-thielemann.de
Sun May 6 06:44:03 UTC 2018


On Sun, 6 May 2018, 박신환 wrote:

> instance Fractional a => Monoid (RecipSum a) where
> 
>     mempty = RecipSum (1 / 0)

This would fail for Rational. I'd prefer to simply use Sum monoid on 
reciprocal values. It also has the advantage that you only need to call 
'recip' once after a sequence of (<>).


More information about the Libraries mailing list