strange error in haskell about indentation of if-then-else

Posted by Drakosha on Stack Overflow See other posts from Stack Overflow or by Drakosha
Published on 2010-05-31T19:29:22Z Indexed on 2010/05/31 19:33 UTC
Read the original article Hit count: 285

Filed under:
|
|
|

I have the following code:

foo :: Int -> [String] -> [(FilePath, Integer)] -> IO Int
foo _ [] _ = return 4
foo _ _ [] = return 5
foo n nameREs pretendentFilesWithSizes = do
  result <- (bar n (head nameREs) pretendentFilesWithSizes)
  if result == 0
  then return 0 --  <========================================== here is the error
  else foo n (tail nameREs) pretendentFilesWithSizes

I get an error on the line with the comment above, the error is:

aaa.hs:56:2:
    parse error (possibly incorrect indentation)

I'm working with emacs, there's no spaces, and i do not understand what did i do wrong.

© Stack Overflow or respective owner

Related posts about beginner

Related posts about error