@@ -59,10 +59,20 @@ parseIdentifierAndValue = (,) <$> (C.indented *> C.identifier <* C.indented <* C
5959parseAbs :: P.Parsec String ParseState Value
6060parseAbs = do
6161 C.lexeme $ P.char '\\'
62− args <- (C.indented *> C.parseIdent) `P.sepBy` (C.indented *> C.comma)
63− C.lexeme $ C.indented *> P.string "->"
64− value <- parseValue
65− return $ Abs args value
62+ uncurriedAbs <|> curriedAbs
63+ where
64+ uncurriedAbs :: P.Parsec String ParseState Value
65+ uncurriedAbs = do
66+ args <- C.indented *> C.parens ((C.indented *> C.parseIdent) `P.sepBy` (C.indented *> C.comma))
67+ C.lexeme $ C.indented *> P.string "->"
68+ value <- parseValue
69+ return $ Abs args value
70+ curriedAbs :: P.Parsec String ParseState Value
71+ curriedAbs = do
72+ args <- P.many1 (C.indented *> C.parseIdent)
73+ C.lexeme $ C.indented *> P.string "->"
74+ value <- parseValue
75+ return $ foldl (\ret arg -> Abs [arg] ret) value args
6676
6777parseApp :: P.Parsec String ParseState Value
6878parseApp = App <$> parseValue