git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Fix #634
commitb8090a37635a40579b774e81f4f654d7c8fc3b65 authorPhil Freeman <paf31@cantab.net> dateTue 28 Oct 2014, 19:44 (12 years ago) parent4423b8c
2 files changed+12−5
examples/passing/EmptyRow.purs+8 src/Language/PureScript/Parser/Types.hs+4−5
examples/passing/EmptyRow.pursnew file+8
@@ -0,0 +1,8 @@
1+module Main where
2+
3+data Foo r = Foo { | r }
4+
5+test :: Foo ()
6+test = Foo {}
7+
8+main = Debug.Trace.trace "Done"
src/Language/PureScript/Parser/Types.hs+4−5
@@ -40,7 +40,7 @@ parseFunction :: P.Parsec String ParseState Type
4040parseFunction = parens $ P.try (lexeme (P.string "->")) >> return tyFunction
4141
4242parseObject :: P.Parsec String ParseState Type
43−parseObject = braces $ TypeApp tyObject <$> parseRow False
43+parseObject = braces $ TypeApp tyObject <$> parseRow
4444
4545parseTypeVariable :: P.Parsec String ParseState Type
4646parseTypeVariable = do
@@ -67,7 +67,7 @@ parseTypeAtom = indented *> P.choice (map P.try
6767 , parseTypeVariable
6868 , parseTypeConstructor
6969 , parseForAll
70− , parens (parseRow True)
70+ , parens parseRow
7171 , parens parsePolyType ])
7272
7373parseConstrainedType :: P.Parsec String ParseState Type
@@ -111,6 +111,5 @@ parseNameAndType p = (,) <$> (indented *> (identifier <|> stringLiteral) <* inde
111111parseRowEnding :: P.Parsec String ParseState Type
112112parseRowEnding = P.option REmpty (TypeVar <$> (lexeme (indented *> P.char '|') *> indented *> identifier))
113113
114−parseRow :: Bool -> P.Parsec String ParseState Type
115−parseRow nonEmpty = (curry rowFromList <$> many' (parseNameAndType parsePolyType) <*> parseRowEnding) P.<?> "row"
116− where many' = if nonEmpty then commaSep1 else commaSep
114+parseRow :: P.Parsec String ParseState Type
115+parseRow = (curry rowFromList <$> commaSep (parseNameAndType parsePolyType) <*> parseRowEnding) P.<?> "row"