git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Don't parse nullary functions
6b6cfc0Gary Burgess
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 @@
1module Functions where
1module Functions where
2
2
3− test1 = \ -> 0
3+ test1 = \_ -> 0
4
4
5− test2 = \_ -> 0
5+ test2 = \a b c d -> a + b + c + d
6
6
7− test3 = \a b c d -> a + b + c + d
7+ test3 = \a -> a
8
8
9− test4 = \a -> a
9+ test4 = \(%%) -> 1 %% 2
10
10
11− test5 = \(%%) -> 1 %% 2
11+ test5 = \(+++) (***) -> 1 +++ 2 *** 3
12−
13− test6 = \(+++) (***) -> 1 +++ 2 *** 3
14
12
15module Main where
13module Main where
16
14
src/Language/PureScript/Parser/Values.hs+1−1
@@ -54,7 +54,7 @@ parseIdentifierAndValue = (,) <$> (C.indented *> C.identifier <* C.indented <* C
54parseAbs :: P.Parsec String ParseState Value
54parseAbs :: P.Parsec String ParseState Value
55parseAbs = do
55parseAbs = do
56 C.reservedOp "\\"
56 C.reservedOp "\\"
57− args <- P.many (C.indented *> (Abs <$> C.parseIdent))
57+ args <- P.many1 (C.indented *> (Abs <$> C.parseIdent))
58 C.indented *> C.reservedOp "->"
58 C.indented *> C.reservedOp "->"
59 value <- parseValue
59 value <- parseValue
60 return $ toFunction args value
60 return $ toFunction args value