[Haskell-cafe] do/if/then/else confusion
dmc at sanger.ac.uk
Thu Nov 1 13:47:40 EDT 2007
Another newbie question, but I can't seem to find any answers on the web...
Can someone tell me what's wrong with this?
import qualified System.Posix.Directory as PD
readdirAll :: PD.DirStream -> IO [String]
readdirAll d =
do dir <- PD.readDirStream d
if dir == ""
then return 
else rest <- readdirAll d
Compiling with GHC 6.6.1 gives me the not-very-useful message "Parse
error in pattern", pointing to the "i" of "if". I've tried all kinds of
alternative indentations (including indenting the "else" more),
bracketings etc, but nothing helps.
The Wellcome Trust Sanger Institute is operated by Genome Research
Limited, a charity registered in England with number 1021457 and a
company registered in England with number 2742969, whose registered
office is 215 Euston Road, London, NW1 2BE.
More information about the Haskell-Cafe