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


Groups > comp.lang.haskell > #456

Re: parse error on input when print specified lines of a file

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 2016-08-23 11:00 +0100
Organization A noiseless patient Spider
Message-ID <87d1kzst3t.fsf@bsb.me.uk> (permalink)
References <cc369812-eba8-4c76-86e0-3f06e1e91d59@googlegroups.com>

Show all headers | View raw


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.

Back to comp.lang.haskell | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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