@@ -60,12 +60,17 @@ parseTypeSynonymDeclaration =
6060 <*> (lexeme (indented *> P.char '=') *> parsePolyType)
6161
6262parseValueDeclaration :: P.Parsec String ParseState Declaration
63−parseValueDeclaration =
64− ValueDeclaration <$> parseIdent
65− <*> pure Value
66− <*> P.many parseBinderNoParens
67− <*> P.optionMaybe parseGuard
68− <*> (lexeme (indented *> P.char '=') *> parseValue)
63+parseValueDeclaration = do
64+ name <- parseIdent
65+ binders <- P.many parseBinderNoParens
66+ guard <- P.optionMaybe parseGuard
67+ value <- lexeme (indented *> P.char '=') *> parseValue
68+ whereClause <- P.optionMaybe $ do
69+ C.indented
70+ reserved "where"
71+ C.indented
72+ C.mark $ P.many1 (C.same *> parseLocalDeclaration)
73+ return $ ValueDeclaration name Value binders guard (maybe value (`Let` value) whereClause)
6974
7075parseExternDeclaration :: P.Parsec String ParseState Declaration
7176parseExternDeclaration = P.try (reserved "foreign") *> indented *> reserved "import" *> indented *>