@@ -327,13 +327,19 @@ spaces =
328forcedWS :: IParser String
328forcedWS :: IParser String
329forcedWS =
329forcedWS =
330− choice
330+ do ws <- many1 (spaces <|> newline)
331− [ (++) <$> spaces <*> (concat <$> many nl_space)
331+ column <- sourceColumn <$> getPosition
332− , concat <$> many1 nl_space
332+ if column == 1
333− ]
333+ then fail badWhiteSpaceMessage
334− where
334+ else return (concat ws)
336− try ((++) <$> (concat <$> many1 newline) <*> spaces)
336+
337+badWhiteSpaceMessage :: String
338+badWhiteSpaceMessage =
339+ "I need whitespace, but got stuck on what looks like a new declaration.\n"
341+ ++ "You are either missing some stuff in the declaration above or just need to add\n"
342+ ++ "some spaces here:"
339-- Just eats whitespace until the next meaningful character.
345-- Just eats whitespace until the next meaningful character.