Skip to content

Commit

Permalink
Fix #634
Browse files Browse the repository at this point in the history
  • Loading branch information
paf31 committed Oct 29, 2014
1 parent 4423b8c commit b8090a3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
8 changes: 8 additions & 0 deletions examples/passing/EmptyRow.purs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module Main where

data Foo r = Foo { | r }

test :: Foo ()
test = Foo {}

main = Debug.Trace.trace "Done"
9 changes: 4 additions & 5 deletions src/Language/PureScript/Parser/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ parseFunction :: P.Parsec String ParseState Type
parseFunction = parens $ P.try (lexeme (P.string "->")) >> return tyFunction

parseObject :: P.Parsec String ParseState Type
parseObject = braces $ TypeApp tyObject <$> parseRow False
parseObject = braces $ TypeApp tyObject <$> parseRow

parseTypeVariable :: P.Parsec String ParseState Type
parseTypeVariable = do
Expand All @@ -67,7 +67,7 @@ parseTypeAtom = indented *> P.choice (map P.try
, parseTypeVariable
, parseTypeConstructor
, parseForAll
, parens (parseRow True)
, parens parseRow
, parens parsePolyType ])

parseConstrainedType :: P.Parsec String ParseState Type
Expand Down Expand Up @@ -111,6 +111,5 @@ parseNameAndType p = (,) <$> (indented *> (identifier <|> stringLiteral) <* inde
parseRowEnding :: P.Parsec String ParseState Type
parseRowEnding = P.option REmpty (TypeVar <$> (lexeme (indented *> P.char '|') *> indented *> identifier))

parseRow :: Bool -> P.Parsec String ParseState Type
parseRow nonEmpty = (curry rowFromList <$> many' (parseNameAndType parsePolyType) <*> parseRowEnding) P.<?> "row"
where many' = if nonEmpty then commaSep1 else commaSep
parseRow :: P.Parsec String ParseState Type
parseRow = (curry rowFromList <$> commaSep (parseNameAndType parsePolyType) <*> parseRowEnding) P.<?> "row"

0 comments on commit b8090a3

Please sign in to comment.