Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.haskell > #455 > unrolled thread

parse error on input when print specified lines of a file

Started bymeInvent bbird <jobmattcon@gmail.com>
First post2016-08-23 01:52 -0700
Last post2016-08-24 10:07 +0100
Articles 5 — 2 participants

Back to article view | Back to comp.lang.haskell


Contents

  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

#455 — parse error on input when print specified lines of a file

FrommeInvent bbird <jobmattcon@gmail.com>
Date2016-08-23 01:52 -0700
Subjectparse error on input when print specified lines of a file
Message-ID<cc369812-eba8-4c76-86e0-3f06e1e91d59@googlegroups.com>
parse error on input `\'

import System.IO  
import Control.Monad

main = do
  file <- readFile "hello.txt"
  forM_ [5..7] (lines file) \i -> 
      putStrLn i 

[toc] | [next] | [standalone]


#456

FromBen Bacarisse <ben.usenet@bsb.me.uk>
Date2016-08-23 11:00 +0100
Message-ID<87d1kzst3t.fsf@bsb.me.uk>
In reply to#455
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.

-- 
Ben.

[toc] | [prev] | [next] | [standalone]


#457

FrommeInvent bbird <jobmattcon@gmail.com>
Date2016-08-23 18:40 -0700
Message-ID<ee88453c-d7f6-412e-8959-bd938587d8f8@googlegroups.com>
In reply to#456
would like to choose specified lines to display

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.
> 
> -- 
> Ben.

[toc] | [prev] | [next] | [standalone]


#458

FrommeInvent bbird <jobmattcon@gmail.com>
Date2016-08-23 18:49 -0700
Message-ID<90d3a4de-100e-4a65-bdc1-7a92d501a010@googlegroups.com>
In reply to#457
line number 5 to line number 7

On Wednesday, August 24, 2016 at 9:40:55 AM UTC+8, meInvent bbird wrote:
> would like to choose specified lines to display
> 
> 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.
> > 
> > -- 
> > Ben.

[toc] | [prev] | [next] | [standalone]


#459

FromBen Bacarisse <ben.usenet@bsb.me.uk>
Date2016-08-24 10:07 +0100
Message-ID<87wpj6pmab.fsf@bsb.me.uk>
In reply to#457
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.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.haskell


csiph-web