[Haskell-cafe] Sub-optimal [code]
James Andrew Cook
mokus at deepbondi.net
Wed Feb 16 19:31:05 CET 2011
On Feb 15, 2011, at 6:05 PM, Daniel Fischer <daniel.is.fischer at googlemail.com> wrote:
> On Tuesday 15 February 2011 23:29:39, Andrew Coppin wrote:
>>
>> Ouch!
>>
>> I suppose what we could really do with is a combinator that runs a
>> monadic action N times, without actually constructing a list N elements
>> long in order to do so.
>
> True enough. But I guess nobody¹ bothered yet because there are so many
> possible designs and most of them are trivial to implement in a line or two
> (so the pain of writing them repeatedly isn't bad enough).
>
> ¹ Not quite true, there's the monad-loops package on hackage which provides
> a handful of loops. But not the trivial nTimesDo.
>
Doesn't Control.Monad.replicateM_ do exactly that?
-- James
More information about the Haskell-Cafe
mailing list