git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Fix #2092, precedence of type application (#2098)
73746d9Phil Freeman
examples/passing/TypeOperators.purs+8
@@ -5,6 +5,14 @@ import A (type (~>), type (/\), (/\))
5natty ∷ ∀ f. f ~> f
5natty ∷ ∀ f. f ~> f
6natty x = x
6natty x = x
7
7
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+
8swap ∷ ∀ a b. a /\ b → b /\ a
16swap ∷ ∀ a b. a /\ b → b /\ a
9swap (a /\ b) = b /\ a
17swap (a /\ b) = b /\ a
10
18
src/Language/PureScript/Parser/Types.hs+2−2
@@ -82,10 +82,10 @@ parseConstrainedType = do
82parseAnyType :: TokenParser Type
82parseAnyType :: TokenParser Type
83parseAnyType = P.buildExpressionParser operators (buildPostfixParser postfixTable parseTypeAtom) P.<?> "type"
83parseAnyType = P.buildExpressionParser operators (buildPostfixParser postfixTable parseTypeAtom) P.<?> "type"
84 where
84 where
85+ operators = [ [ P.Infix (return TypeApp) P.AssocLeft ]
85− operators = [ [ P.Infix (P.try (parseQualified (Op <$> symbol)) >>= \ident ->
86+ , [ P.Infix (P.try (parseQualified (Op <$> symbol)) >>= \ident ->
86 return (BinaryNoParensType (TypeOp ident))) P.AssocRight
87 return (BinaryNoParensType (TypeOp ident))) P.AssocRight
87 ]
88 ]
88− , [ P.Infix (return TypeApp) P.AssocLeft ]
89 , [ P.Infix (rarrow >> return function) P.AssocRight ]
89 , [ P.Infix (rarrow >> return function) P.AssocRight ]
90 ]
90 ]
91 postfixTable = [ \t -> KindedType t <$> (indented *> doubleColon *> parseKind)
91 postfixTable = [ \t -> KindedType t <$> (indented *> doubleColon *> parseKind)