The type of the initial and result values really does not need to
have anything to do with the type of the list elements. A typical
example is the function
length = foldl (\n _ -> 1+n) 0
which finds the length of a list: the initial and result values are
integers, and the list elements can be of any type whatsoever.
But I don't see a connection between this fact and the use of
monads. (Monads are a purely functional device for uniform handling
of computations that, presumably, do not fit well in the purely
functional style.)
I also do not understand what are the issues mentioned in the initial
post. Is it something related to list lengths, or types, or ...?
Raul, would you please elaborate a bit on this?
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm