Re: mapM/concatMapMy

2000-10-24 Thread John Hughes
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

Re: mapM/concatMapMy

2000-10-23 Thread Richard
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

Re: mapM/concatMapMy

2000-10-18 Thread Sengan Baring-Gould
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

Re: mapM/concatMapMy

2000-10-18 Thread Sengan Baring-Gould
> > [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

Re: mapM/concatMapMy

2000-10-18 Thread Sengan Baring-Gould
> > > [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