Skip to content

Commit

Permalink
Merge pull request #574 from purescript/569
Browse files Browse the repository at this point in the history
Fix #569
  • Loading branch information
paf31 committed Aug 25, 2014
2 parents 2e0559b + db4fd45 commit 6409289
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions examples/passing/OperatorAssociativity.purs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module Main where

import Control.Monad.Eff

bug :: Number -> Number -> Number
bug a b = 0 - (a - b)

foreign import explode
"function explode() {\
\ throw new Error('Assertion failed!');\
\}":: forall eff a. Eff eff a

main = case bug 0 2 of
2 -> Debug.Trace.trace "Done!"
_ -> explode
2 changes: 1 addition & 1 deletion src/Language/PureScript/Pretty/JS.hs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ unary op str = Wrap match (++)
match' _ = Nothing

binary :: BinaryOperator -> String -> Operator PrinterState JS String
binary op str = AssocR match (\v1 v2 -> v1 ++ " " ++ str ++ " " ++ v2)
binary op str = AssocL match (\v1 v2 -> v1 ++ " " ++ str ++ " " ++ v2)
where
match :: Pattern PrinterState JS (JS, JS)
match = mkPattern match'
Expand Down

0 comments on commit 6409289

Please sign in to comment.