
18 Sep
2009
18 Sep
'09
4:04 p.m.
On Fri, Sep 18, 2009 at 8:28 AM, Daniel Fischer
No, summarizeMany would have the type
(Summarizer m s) => [Double] -> Double
which is ambiguous. You would have to make m somehow accessible (dummy argument?).
yes, i realize the type is ambiguous, ghc even says so in the error message. but a dummy argument doesn't seem very elegant.
2) is there a better way of expressing this kind of "on-line" calculation, perhaps in pure (non-monadic) functions?
Perhaps scanl ?
i originally was using mapAccumL (i need the final result of the state) but it seemed like i was missing the point of the State monad. i guess that is a matter of opinion? b