ivanperez-keera / dunai

Classic FRP, Arrowized FRP, Reactive Programming, and Stream Programming, all via Monadic Stream Functions
212 stars 35 forks source link

Data.MonadicStreamFunction.sum is only defined for monoids #7

Closed turion closed 8 years ago

turion commented 8 years ago

It should be defined for Num (or VectorSpace) as well in some way, otherwise one needs this annoying workaround all the time:

import Data.Monoid

mySumFrom :: (Num a, Monad m) => a -> MStreamF m a a
mySumFrom a = arr Sum >>> sumFrom (Sum a) >>> arr getSum
turion commented 8 years ago

Closed with 67af9b1ae4d2f89dc2eb56041b5a6d442caed56f.