git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Don't parse nullary functions
commit6b6cfc0d0246a43e3dcd86e3a635a04a03ef788f authorGary Burgess <garyb@users.noreply.github.com> dateSat 1 Feb 2014, 00:42 (13 years ago) parenta86e71a
3 files changed+9−8
examples/failing/NullaryAbs.purs+3 examples/passing/Functions.purs+5−7 src/Language/PureScript/Parser/Values.hs+1−1
examples/failing/NullaryAbs.pursnew file+3
@@ -0,0 +1,3 @@
1+module NullaryAbs where
2+
3+ func = \ -> "no"
examples/passing/Functions.purs+5−7
@@ -1,16 +1,14 @@
11module Functions where
22
3− test1 = \ -> 0
3+ test1 = \_ -> 0
44
5− test2 = \_ -> 0
5+ test2 = \a b c d -> a + b + c + d
66
7− test3 = \a b c d -> a + b + c + d
7+ test3 = \a -> a
88
9− test4 = \a -> a
9+ test4 = \(%%) -> 1 %% 2
1010
11− test5 = \(%%) -> 1 %% 2
12−
13− test6 = \(+++) (***) -> 1 +++ 2 *** 3
11+ test5 = \(+++) (***) -> 1 +++ 2 *** 3
1412
1513module Main where
1614
src/Language/PureScript/Parser/Values.hs+1−1
@@ -54,7 +54,7 @@ parseIdentifierAndValue = (,) <$> (C.indented *> C.identifier <* C.indented <* C
5454parseAbs :: P.Parsec String ParseState Value
5555parseAbs = do
5656 C.reservedOp "\\"
57− args <- P.many (C.indented *> (Abs <$> C.parseIdent))
57+ args <- P.many1 (C.indented *> (Abs <$> C.parseIdent))
5858 C.indented *> C.reservedOp "->"
5959 value <- parseValue
6060 return $ toFunction args value