Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.haskell > #459
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
| Newsgroups | comp.lang.haskell |
| Subject | Re: parse error on input when print specified lines of a file |
| Date | Wed, 24 Aug 2016 10:07:56 +0100 |
| Organization | A noiseless patient Spider |
| Lines | 30 |
| Message-ID | <87wpj6pmab.fsf@bsb.me.uk> (permalink) |
| References | <cc369812-eba8-4c76-86e0-3f06e1e91d59@googlegroups.com> <87d1kzst3t.fsf@bsb.me.uk> <ee88453c-d7f6-412e-8959-bd938587d8f8@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain |
| Injection-Info | mx02.eternal-september.org; posting-host="017616aa25f81ec581c44d76d61ba2f3"; logging-data="4901"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/E9jI1mE8F07K8DuONV9n0X9Bb1Iq9Ze0=" |
| Cancel-Lock | sha1:PaIpgtktLMBM9PhXNsM7abagHlg= sha1:A0tYq5Hu0ZCw7F0ijZpGRDUo154= |
| X-BSB-Auth | 1.18de7174d82db2895a70.20160824100756BST.87wpj6pmab.fsf@bsb.me.uk |
| Xref | csiph.com comp.lang.haskell:459 |
Show key headers only | View raw
meInvent bbird <jobmattcon@gmail.com> writes: > > On Tuesday, August 23, 2016 at 6:00:07 PM UTC+8, Ben Bacarisse wrote: >> meInvent bbird <jobmattcon@gmail.com> writes: >> >> > parse error on input `\' >> > >> > import System.IO >> > import Control.Monad >> > >> > main = do >> > file <- readFile "hello.txt" >> > forM_ [5..7] (lines file) \i -> >> > putStrLn i >> >> Did you mean >> >> forM_ (lines file) (\i -> putStrLn i) >> >> ? The syntax error is that you need ()s round the lambda expression >> here, but the extra list [5..7] is puzzling me. > > would like to choose specified lines to display Then replace (lines file) with an expression that gives the lines you want. For example (take 2 (drop 4 (lines file))) (which is neater using $ but that's not the point). -- Ben.
Back to comp.lang.haskell | Previous | Next — Previous in thread | Find similar | Unroll thread
parse error on input when print specified lines of a file meInvent bbird <jobmattcon@gmail.com> - 2016-08-23 01:52 -0700
Re: parse error on input when print specified lines of a file Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-08-23 11:00 +0100
Re: parse error on input when print specified lines of a file meInvent bbird <jobmattcon@gmail.com> - 2016-08-23 18:40 -0700
Re: parse error on input when print specified lines of a file meInvent bbird <jobmattcon@gmail.com> - 2016-08-23 18:49 -0700
Re: parse error on input when print specified lines of a file Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-08-24 10:07 +0100
csiph-web