Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.haskell > #515
| From | Barry Fishman <barry@ecubist.org> |
|---|---|
| Newsgroups | comp.lang.haskell |
| Subject | Re: Get mapM to be lazy for IO |
| References | <24548724-4bdd-402d-8a76-1403b7e87169@googlegroups.com> <7nmup95via.fsf@ecube.ecubist.org> |
| Message-ID | <7nimzx5u6q.fsf@ecube.ecubist.org> (permalink) |
| Organization | Easynews - www.easynews.com |
| Date | 2018-12-13 10:21 -0500 |
On 2018-12-13 09:52:45 -05, Barry Fishman wrote: > On 2018-12-11 05:19:18 -08, kfjwheeler@gmail.com wrote: >> I'm kind of a beginner when it comes to Haskell. Specifically with >> regards to IO. >> >> I'm tying to write a very simple program that asks the user to input >> a list of words. It gets words until the user enters "done". >> >> I'm getting close, but it's still asking for input after I enter >> "done". I can't seem to get mapM to be lazy in the way I want. > > IO can be lazy, but the order of actions needs to preserved, so that > each putStrLn prompt precedes it's getLine. Oops, I was wrong. If I replace the: xs <- getWordList 1 with: xs <- take 3 `fmap` getWordList 1 the values continue to be read. So the IO can't be read lazily as far as I can tell. -- Barry Fishman
Back to comp.lang.haskell | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Get mapM to be lazy for IO kfjwheeler@gmail.com - 2018-12-11 05:19 -0800
Re: Get mapM to be lazy for IO Mark Carroll <mtbc@bcs.org> - 2018-12-11 13:36 +0000
Re: Get mapM to be lazy for IO Kaylen Wheeler <kfjwheeler@gmail.com> - 2018-12-12 17:52 -0800
Re: Get mapM to be lazy for IO Paul Rubin <no.email@nospam.invalid> - 2018-12-12 19:29 -0800
Re: Get mapM to be lazy for IO Kaylen Wheeler <kfjwheeler@gmail.com> - 2018-12-12 18:21 -0800
Re: Get mapM to be lazy for IO Paul Rubin <no.email@nospam.invalid> - 2018-12-12 19:31 -0800
Re: Get mapM to be lazy for IO Barry Fishman <barry@ecubist.org> - 2018-12-13 09:52 -0500
Re: Get mapM to be lazy for IO Barry Fishman <barry@ecubist.org> - 2018-12-13 10:21 -0500
Re: Get mapM to be lazy for IO Barry Fishman <barry@ecubist.org> - 2018-12-13 10:46 -0500
csiph-web