| Subject: | Re: [Haskell-cafe] Random numbers / monads - beginner question |
|---|---|
| From: | "Thomas Dinsdale-Young" |
| Date: | Thu, 8 May 2008 12:36:29 +0100 |
Madoc
wrote:
Given a list of numbers, I want to modify each of those numbers by adding a
I may be wrong, but generateInfiniteListOfRandomNumbers won't
terminate and I think it has to before the next IO action occurs.
(Laziness is great, but I don't think you can really do lazy IO like
that.) Instead of map :: (a -> b) -> [a] -> [b], I think you are looking for mapM :: Monad m => (a -> m b) -> [a] -> m [b]. Hope this helps, Thomas _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@xxxxxxxxxxx http://www.haskell.org/mailman/listinfo/haskell-cafe |
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: [Haskell-cafe] Induction (help!), Brent Yorgey |
|---|---|
| Next by Date: | Re: [Haskell-cafe] Random numbers / monads - beginner question, Brent Yorgey |
| Previous by Thread: | [Haskell-cafe] Thanks for the help! (Random numbers / monads - beginner question), Madoc |
| Next by Thread: | Re: [Haskell-cafe] Random numbers / monads - beginner question, Brent Yorgey |
| Indexes: | [Date] [Thread] [Top] [All Lists] |