on master help sign in
Fix generation of infix ops
bdd8213Evan Czaplicki
compiler/Generate/JavaScript.hs+3−3
@@ -378,10 +378,10 @@ binop span op e1 e2 =
378
378
379 opDict = Map.fromList (infixOps ++ specialOps)
379 opDict = Map.fromList (infixOps ++ specialOps)
380
380
381− specialOp str func = ("Basics." ++ str, func)
381+ specialOp str func = [ (str, func), ("Basics." ++ str, func) ]
382 infixOp str op = specialOp str (InfixExpr () op)
382 infixOp str op = specialOp str (InfixExpr () op)
383
383
384− infixOps =
384+ infixOps = concat
385 [ infixOp "+" OpAdd
385 [ infixOp "+" OpAdd
386 , infixOp "-" OpSub
386 , infixOp "-" OpSub
387 , infixOp "*" OpMul
387 , infixOp "*" OpMul
@@ -390,7 +390,7 @@ binop span op e1 e2 =
390 , infixOp "||" OpLOr
390 , infixOp "||" OpLOr
391 ]
391 ]
392
392
393− specialOps =
393+ specialOps = concat
394 [ specialOp "^" $ \a b -> obj "Math.pow" `call` [a,b]
394 [ specialOp "^" $ \a b -> obj "Math.pow" `call` [a,b]
395 , specialOp "|>" $ flip (<|)
395 , specialOp "|>" $ flip (<|)
396 , specialOp "==" $ \a b -> obj "_N.eq" `call` [a,b]
396 , specialOp "==" $ \a b -> obj "_N.eq" `call` [a,b]