Rob Hoelz wrote:
"Brandon S. Allbery KF8NH" <[EMAIL PROTECTED]> wrote:
On May 16, 2007, at 12:23 , Rob Hoelz wrote:
And as long as I'm asking, is there some kind of monadic function
composition operator? I'd like to clean up the above with something
like peekCString . peek . linked_list_getdata...
(=<<)?
Thanks for the reply; I can't believe I missed that one! But while
looking over the documentation, completely humbled, I discovered
sequence, which allows me to write my code cleanly! Thanks for the
help!
sequence still isn't tail-recursive, although sequence_ is. If you want a
tail-recursive sequence, the only way to do it is like this:
sequence' :: [IO a] -> IO [a]
sequence' ms = do
let as = map unsafePerformIO ms
foldr seq (return ()) as
return as
although that's likely to be a lot slower, too.
Cheers,
Simon
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe