Merge pull request #574 from purescript/569
Fix #569
commit6409289f601f5e607b3919cf584bff0a9b131d2e
authorPhil Freeman <paf31@cantab.net>
dateMon 25 Aug 2014, 08:51 (12 years ago)
parent2e0559bdb4fd45
examples/passing/OperatorAssociativity.pursnew file+15
@@ -0,0 +1,15 @@
1+module Main where
2+
3+import Control.Monad.Eff
4+
5+bug :: Number -> Number -> Number
6+bug a b = 0 - (a - b)
7+
8+foreign import explode
9+ "function explode() {\
10+ \ throw new Error('Assertion failed!');\
11+ \}":: forall eff a. Eff eff a
12+
13+main = case bug 0 2 of
14+ 2 -> Debug.Trace.trace "Done!"
15+ _ -> explode
src/Language/PureScript/Pretty/JS.hs+1−1
@@ -190,7 +190,7 @@ unary op str = Wrap match (++)
190190 match' _ = Nothing
191191
192192binary :: BinaryOperator -> String -> Operator PrinterState JS String
193−binary op str = AssocR match (\v1 v2 -> v1 ++ " " ++ str ++ " " ++ v2)
193+binary op str = AssocL match (\v1 v2 -> v1 ++ " " ++ str ++ " " ++ v2)
194194 where
195195 match :: Pattern PrinterState JS (JS, JS)
196196 match = mkPattern match'