Haskell-Wo-Einzug: Warum muss der Einzug nach dem Bezeichner erfolgen?

Dieser Code:

import Data.Char (digitToInt)

myInt :: String -> Int
myInt [] = error "bad input: empty string"
myInt (x:xs)
  | x == '-'  = -1 * myInt xs
  | otherwise = foldl convert 0 (x:xs)
  where convert acc x
        | x `elem` ['0'..'9'] = 10 * acc + digitToInt x
        | otherwise           = error ("bad input: not an int - " ++ [x])

Schlägt fehl:

Prelude> :l safeListFs.hs
[1 of 1] Compiling Main             ( safeListFs.hs, interpreted )

safeListFs.hs:9:8: parse error (possibly incorrect indentation)
Failed, modules loaded: none.

Aber diese Version:

import Data.Char (digitToInt)

myInt :: String -> Int
myInt [] = error "bad input: empty string"
myInt (x:xs)
  | x == '-'  = -1 * myInt xs
  | otherwise = foldl convert 0 (x:xs)
  where convert acc x
          | x `elem` ['0'..'9'] = 10 * acc + digitToInt x
          | otherwise           = error ("bad input: not an int - " ++ [x])

ist in Ordnung:

Prelude> :l safeListFs.hs
[1 of 1] Compiling Main             ( safeListFs.hs, interpreted )
Ok, modules loaded: Main.

Ich kann nicht herausfinden, warum diese beiden letzten Gedankenstriche wichtig sind.

Antworten auf die Frage(3)

Ihre Antwort auf die Frage