Skip to content

Fractional instances for Sum, Product

Should Data.Monoid.Sum and Product have Fractional instances? The current situation means

> 10 <> 20 :: Sum Double
Sum {getSum = 30.0}

compiles but fails with fractional numeric literal

> 10.5 <> 20 :: Sum Double

<interactive>:8:1: error:
    • No instance for (Fractional (Sum Double))
        arising from the literal ‘10.5’
    • In the first argument of ‘(<>)’, namely ‘10.5’
      In the expression: 10.5 <> 20 :: Sum Double
      In an equation for ‘it’: it = 10.5 <> 20 :: Sum Double
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information