David Carter wrote:
Another newbie question, but I can't seem to find any answers on the
web...
Just figured it out myself ... I need a "do" after the "else", of
course. (But I still think the error message is less than helpful!).
Sorry for the bandwidth
David
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
return (dir:rest)
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.
Thanks
David
--
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.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe