[Haskell-cafe] Stack space overflow in HaskellNet
Manfred Lotz
manfred.lotz at arcor.de
Tue Jul 26 17:30:54 CEST 2011
On Tue, 26 Jul 2011 10:17:22 +0200 (CEST)
Henning Thielemann <lemming at henning-thielemann.de> wrote:
>
> On Mon, 25 Jul 2011, Manfred Lotz wrote:
>
> > Hi there,
> > If I take example imap.hs
> >
> >
> > import System.IO
> > import Network.HaskellNet.IMAP
> > import Text.Mime
> > import qualified Data.ByteString.Char8 as BS
> > import Control.Monad
> >
> > -- the next lines were changed to fit to my local imap server
> > imapServer = "imap.mail.org"
> > user = ""
> > pass = ""
> >
> > main = do
s> > con <- connectIMAP imapServer
> > login con user pass
> > mboxes <- list con
> > mapM print mboxes
>
> This should be mapM_ and 'ghc -Wall' spots this problem since 6.12.
>
The compiler (7.04) doesn't tell me anything about it.
> > select con "INBOX"
> > msgs <- search con [ALLs]
> > mapM_ (\x -> print x) (take 4 msgs)
> > forM_ (take 4msgs) (\x -> fetch con x >>= print)
I'm not quite sure I understand what you mean. Stack overflow comes
from this:
forM_ msgs (\x -> fetch con x >>= print)
If I change it to:
mapM_ (\x -> fetch con x >>= print) msgs
there is the same stack overflow.
--
Thanks,
Manfred
More information about the Haskell-Cafe
mailing list