git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Fix #569
db4fd45Phil Freeman
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 (++)
190 match' _ = Nothing
190 match' _ = Nothing
191
191
192binary :: BinaryOperator -> String -> Operator PrinterState JS String
192binary :: 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)
194 where
194 where
195 match :: Pattern PrinterState JS (JS, JS)
195 match :: Pattern PrinterState JS (JS, JS)
196 match = mkPattern match'
196 match = mkPattern match'