git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Make operator precedence in the Prelude match Haskell #176
commit6fd0295d026c95e2e8b805bb9e3a8e249f83dc82 authorPhil Freeman <paf31@cantab.net> dateThu 6 Feb 2014, 14:42 (13 years ago) parent315498f
3 files changed+21−21
examples/passing/Eff.purs+1−1 libraries/prelude/prelude.purs+19−19 src/Language/PureScript/Sugar/Operators.hs+1−1
examples/passing/Eff.purs+1−1
@@ -24,4 +24,4 @@ import TestEff
2424main = do
2525 n <- test1
2626 Trace.print n
27− --Trace.print test2
27+ Trace.print test2
libraries/prelude/prelude.purs+19−19
@@ -12,8 +12,8 @@ module Prelude where
1212 konst :: forall a b. a -> b -> a
1313 konst a _ = a
1414
15− infixr 5 >>>
16− infixr 5 <<<
15+ infixr 9 >>>
16+ infixr 9 <<<
1717
1818 class Category a where
1919 id :: forall t. a t t
@@ -25,8 +25,8 @@ module Prelude where
2525 (<<<) f g x = f (g x)
2626 (>>>) f g x = g (f x)
2727
28− infixr 1000 $
29− infixl 1000 #
28+ infixr 0 $
29+ infixl 0 #
3030
3131 ($) :: forall a b. (a -> b) -> a -> b
3232 ($) f x = f x
@@ -92,12 +92,12 @@ module Prelude where
9292 a' <- a
9393 ret (f' a')
9494
95− infixl 5 *
96− infixl 5 /
97− infixl 5 %
95+ infixl 7 *
96+ infixl 7 /
97+ infixl 7 %
9898
99− infixl 7 -
100− infixl 7 +
99+ infixl 6 -
100+ infixl 6 +
101101
102102 class Num a where
103103 (+) :: a -> a -> a
@@ -149,8 +149,8 @@ module Prelude where
149149 (%) = numMod
150150 negate = numNegate
151151
152− infixl 9 ==
153− infixl 9 /=
152+ infixl 4 ==
153+ infixl 4 /=
154154
155155 class Eq a where
156156 (==) :: a -> a -> Boolean
@@ -205,10 +205,10 @@ module Prelude where
205205 (==) _ _ = false
206206 (/=) xs ys = not (xs == ys)
207207
208− infixl 3 <
209− infixl 3 >
210− infixl 3 <=
211− infixl 3 >=
208+ infixl 4 <
209+ infixl 4 >
210+ infixl 4 <=
211+ infixl 4 >=
212212
213213 class Ord a where
214214 (<) :: a -> a -> Boolean
@@ -308,7 +308,7 @@ module Prelude where
308308 zshr = numZshr
309309 complement = numComplement
310310
311− infixl 4 !!
311+ infixl 8 !!
312312
313313 foreign import (!!) "function $bang$bang(xs) {\
314314 \ return function(n) {\
@@ -316,8 +316,8 @@ module Prelude where
316316 \ };\
317317 \}" :: forall a. [a] -> Number -> a
318318
319− infixr 11 ||
320− infixr 11 &&
319+ infixr 2 ||
320+ infixr 3 &&
321321
322322 class BoolLike b where
323323 (&&) :: b -> b -> b
@@ -345,7 +345,7 @@ module Prelude where
345345 (||) = boolOr
346346 not = boolNot
347347
348− infixr 6 ++
348+ infixr 5 ++
349349
350350 foreign import (++) "function $plus$plus(s1) {\
351351 \ return function(s2) {\
src/Language/PureScript/Sugar/Operators.hs+1−1
@@ -60,7 +60,7 @@ customOperatorTable fixities =
6060 let
6161 applyUserOp name t1 t2 = App (App (Var name) t1) t2
6262 userOps = map (\(name, Fixity a p) -> (name, applyUserOp name, p, a)) . M.toList $ fixities
63− sorted = sortBy (compare `on` (\(_, _, p, _) -> p)) userOps
63+ sorted = reverse $ sortBy (compare `on` (\(_, _, p, _) -> p)) userOps
6464 groups = groupBy ((==) `on` (\(_, _, p, _) -> p)) sorted
6565 in
6666 map (map (\(name, f, _, a) -> (name, f, a))) groups