Sengan Baring-Gould writes:
>Is >>= not lazy?
since no experts have answered yet, this newbie will answer.
I think it's strict.
Well, it depends. (>>=) is an overloaded operator, with a different
implementation for every monad -- when you define a monad, you gi
Sengan Baring-Gould writes:
>Is >>= not lazy?
since no experts have answered yet, this newbie will answer.
I think it's strict.
somewhere in the compiler doco, IIRC, it says (>>=) was lazy at
first, but experience showed it was more confusing for users
(Haskell programmers).
moreover, from the
Actually I think I figured it out:
(>>=) (f c) (\x -> (>>=) (mapM f cs) (\xs -> return (x:xs)))
-> (>>=) _(f c)_ (\x -> (>>=) (mapM f cs) (\xs -> return (x:xs)))
-> (>>=) (MN c1) (\x -> (>>=) (mapM f cs) (\xs -> return (x:xs)))
-> (\(MN c1) \fc2 -> MN $ \s0 -> let (r1,io1,s1) = c1 s0
> > [EMAIL PROTECTED] (Sengan Baring-Gould) wrote:
> >
> > > mapM seems to be a memory hog (and thus also concatMapM).
> > > In the following eg:
> > >
> > > > main = mapM print ([1..102400] :: [Integer])
> > >
> > > memory usage climbs to 1.6M with ghc and needs -K20M
> >
> > As a guess: sinc
>
>
> [EMAIL PROTECTED] (Sengan Baring-Gould) wrote:
>
> > mapM seems to be a memory hog (and thus also concatMapM).
> > In the following eg:
> >
> > > main = mapM print ([1..102400] :: [Integer])
> >
> > memory usage climbs to 1.6M with ghc and needs -K20M
>
> As a guess: since 'mapM print