[Haskell-beginners] Empty 'do' constructor
Brent Yorgey
byorgey at seas.upenn.edu
Sat Sep 25 00:49:14 EDT 2010
On Sat, Sep 25, 2010 at 01:43:33PM +0900, Sok H. Chang wrote:
> I use Haskell Platform 2010.2.0.0 on WinXP, and jEdit.
> I write my first code, and got error...
>
> main = do cs <- readFile "C:\\SPR.txt"
> putStrLn $ myManupulation cs
>
> myManupulation cs = (unlines cs) ! 3
Because putStrLn is not indented it is not considered part of the
do-block. You should line it up under the stuff after the 'do',
like this:
main = do cs <- readFile "C:\\SPR.txt"
putStrLn $ myManupulation cs
-Brent
More information about the Beginners
mailing list