git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Merge pull request #2299 from purescript/phil/parser-issue
3507741Phil Freeman
examples/passing/ConstraintParsingIssue.pursnew file+9
@@ -0,0 +1,9 @@
1+module Main where
2+
3+import Control.Monad.Eff.Console
4+
5+class X a
6+
7+instance x :: X (Array (Array a)) => X (Array a)
8+
9+main = log "Done"
src/Language/PureScript/Parser/Types.hs+2−4
@@ -54,8 +54,7 @@ parseForAll = mkForAll <$> ((reserved "forall" <|> reserved "∀") *> P.many1 (i
54--
54--
55parseTypeAtom :: TokenParser Type
55parseTypeAtom :: TokenParser Type
56parseTypeAtom = indented *> P.choice
56parseTypeAtom = indented *> P.choice
57− [ P.try parseConstrainedType
58− , P.try parseFunction
57+ [ P.try parseFunction
59 , parseTypeLevelString
58 , parseTypeLevelString
60 , parseObject
59 , parseObject
61 , parseTypeWildcard
60 , parseTypeWildcard
@@ -81,9 +80,8 @@ parseConstrainedType = do
81 ty <- P.many parseTypeAtom
80 ty <- P.many parseTypeAtom
82 return (Constraint className ty Nothing)
81 return (Constraint className ty Nothing)
83
82
84−
85parseAnyType :: TokenParser Type
83parseAnyType :: TokenParser Type
86−parseAnyType = P.buildExpressionParser operators (buildPostfixParser postfixTable parseTypeAtom) P.<?> "type"
84+parseAnyType = P.buildExpressionParser operators (buildPostfixParser postfixTable (P.try parseConstrainedType <|> parseTypeAtom)) P.<?> "type"
87 where
85 where
88 operators = [ [ P.Infix (return TypeApp) P.AssocLeft ]
86 operators = [ [ P.Infix (return TypeApp) P.AssocLeft ]
89 , [ P.Infix (P.try (parseQualified parseOperator) >>= \ident ->
87 , [ P.Infix (P.try (parseQualified parseOperator) >>= \ident ->