git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Fix #2092, precedence of type application (#2098)

* Fix #2092, precedence of type application * one more test

commit73746d9d5035fd6dcd8cf87a22518ce2e3f02441 authorPhil Freeman <paf31@cantab.net> dateSun 8 May 2016, 11:50 (10 years ago) parentfac68e5
2 files changed+10−2
examples/passing/TypeOperators.purs+8 src/Language/PureScript/Parser/Types.hs+2−2
examples/passing/TypeOperators.purs+8
@@ -5,6 +5,14 @@ import A (type (~>), type (/\), (/\))
55natty ∷ ∀ f. f ~> f
66natty x = x
77
8+data Compose f g a = Compose (f (g a))
9+
10+testPrecedence1 ∷ ∀ f g. Compose f g ~> Compose f g
11+testPrecedence1 x = x
12+
13+testPrecedence2 ∷ ∀ f g. f ~> g → f ~> g
14+testPrecedence2 nat fx = nat fx
15+
816swap ∷ ∀ a b. a /\ b → b /\ a
917swap (a /\ b) = b /\ a
1018
src/Language/PureScript/Parser/Types.hs+2−2
@@ -82,10 +82,10 @@ parseConstrainedType = do
8282parseAnyType :: TokenParser Type
8383parseAnyType = P.buildExpressionParser operators (buildPostfixParser postfixTable parseTypeAtom) P.<?> "type"
8484 where
85− operators = [ [ P.Infix (P.try (parseQualified (Op <$> symbol)) >>= \ident ->
85+ operators = [ [ P.Infix (return TypeApp) P.AssocLeft ]
86+ , [ P.Infix (P.try (parseQualified (Op <$> symbol)) >>= \ident ->
8687 return (BinaryNoParensType (TypeOp ident))) P.AssocRight
8788 ]
88− , [ P.Infix (return TypeApp) P.AssocLeft ]
8989 , [ P.Infix (rarrow >> return function) P.AssocRight ]
9090 ]
9191 postfixTable = [ \t -> KindedType t <$> (indented *> doubleColon *> parseKind)