[Haskell-cafe] beginner's problam with a monad
dan.doel at gmail.com
Sun Sep 3 13:51:30 EDT 2006
On 9/3/06, Julien Oster <haskell at lists.julien-oster.de> wrote:
> Why does the interpreter infer Tracker a a instead of the more general
> Tracker a c?
The problem is that you're trying to keep a list of all computations
performed, and lists can only store values of one uniform type. So, if
you have a Tracker storing a list of values of type [a], it must also
represent a computation of type a via the second argument, because
that's the only type it can append to the list.
Thus, unfortunately, you won't be able to implement the general bind
operator. To do so, you'd need to have Tracker use a list that can
store values of heterogeneous types, which is an entire library unto
Hope that helps some,
More information about the Haskell-Cafe