
Thanks for the continued help. The only issue with your recently described approach is that, as near as I can tell, it requires the terms to be integral. data Arbitrary a = Arbitrary (a -> a) class PartialSum term where partialSum :: (Integral a) => a -> term a -> a instance PartialSum Arbitrary where partialSum n (Arbitrary f) = sum $ map f [1..n] I cannot, for example, do h> partialSum 10 (Arbitrary (\x -> 1.5 * x :: Float)) <interactive>:88:1: No instance for (Integral Float) arising from a use of `partialSum' Possible fix: add an instance declaration for (Integral Float) In the expression: partialSum 10 (Arbitrary (\ x -> 1.5 * x :: Float)) In an equation for `it': it = partialSum 10 (Arbitrary (\ x -> 1.5 * x :: Float)) h> partialSum 10 (Arbitrary (\ x -> (1 % 5) * x)) <interactive>:100:1: No instance for (Integral (Ratio a0)) arising from a use of `partialSum' Possible fix: add an instance declaration for (Integral (Ratio a0)) In the expression: partialSum 10 (Arbitrary (\ x -> (1 % 5) * x)) In an equation for `it': it = partialSum 10 (Arbitrary (\ x -> (1 % 5) * x))