Proposal: Add concatMapM function (#2042)

Aaron Denney wnoise at
Fri Feb 1 15:14:42 EST 2008

On 2008-02-01, Roman Leshchinskiy <rl at> wrote:
> Aaron Denney wrote:
>> On 2008-02-01, Roman Leshchinskiy <rl at> wrote:
>>> Bulat Ziganshin wrote:
>>>> the right way to deal with "modifiers" is to attach them to the Handle
>>>> itself like this:
>>>> f <- openFile "name" >>= withLocking >>= withEncoding utf8
>>> IMO, global state is never "the right way" if it can be avoided. It will 
>>> always lead to problems. Especially in a functional language like Haskell.
>> This isn't global state, but local to the handle, and only affects where
>> the handle is passed in.  It's just extending an opaque data type.
> If I can destructively change the encoding assocated with a Handle, then 
> it's global state.

Right.  But the example given doesn't necessarily have that.

x <- [5, 6] >>= (return .) (+ 1) 

No modification is going on, but return of new values.

I don't know how Bulat's stream library is implemented, but I expected a
new handle wrapping the old to be returned.

Aaron Denney

More information about the Libraries mailing list