fsum :: (Foldable f, Num a) ⇒ f a → a
It computes the sum of all numbers in a container-like data structure.
My problem is that I cannot define f a
as a list or Maybe
or any other foldable types to have access. So I am assuming I should write
fsum x = ....
But I have no clue how to fold it given that a
is not a monoid.
Any opinions?
Thanks in advance