[Haskell-beginners] Empty 'do' constructor
verdier.jean at gmail.com
Mon Sep 27 03:50:45 EDT 2010
You are expecting unlines to be String -> [String] but it's [String] ->
String. The function you're looking for is probably Data.List.lines.
The list indexing operator is !! and not !.
Your function should then probably be:
myManupulation cs = (lines cs) !! 3
On Sat, 2010-09-25 at 10:02 +0100, Magnus Therning wrote:
> On 25/09/10 08:21, Sok H. Chang wrote:
> > Thank you to your answer!
> > I indent me code as you said.
> > I tried using Tab, using spaces…
> > But can't work.
> > Is there another possibility?
> > Thank you!
> With the code looking like this:
> main = do cs <- readFile "C:\\SPR.txt"
> putStrLn $ myManupulation cs
> myManupulation cs = (unlines cs) ! 3
> Then it's indented properly, but it still doesn't compile because its types
> don't line up properly.
> Beginners mailing list
> Beginners at haskell.org
More information about the Beginners