@@ -86,6 +86,8 @@ inlineCommonValues = everywhereOnJS convert
86 | isDict' [semiringNumber, semiringInt] dict && isFn fnOne fn = JSNumericLiteral ss (Left 1)
86 | isDict' [semiringNumber, semiringInt] dict && isFn fnOne fn = JSNumericLiteral ss (Left 1)
87 | isDict boundedBoolean dict && isFn fnBottom fn = JSBooleanLiteral ss False
87 | isDict boundedBoolean dict && isFn fnBottom fn = JSBooleanLiteral ss False
88 | isDict boundedBoolean dict && isFn fnTop fn = JSBooleanLiteral ss True
88 | isDict boundedBoolean dict && isFn fnTop fn = JSBooleanLiteral ss True
89+ convert (JSApp ss (JSApp _ fn [dict]) [x])
90+ | isDict ringInt dict && isFn fnNegate fn = JSBinary ss BitwiseOr (JSUnary ss Negate x) (JSNumericLiteral ss (Left 0))
89 convert (JSApp ss (JSApp _ (JSApp _ fn [dict]) [x]) [y])
91 convert (JSApp ss (JSApp _ (JSApp _ fn [dict]) [x]) [y])
90 | isDict semiringInt dict && isFn fnAdd fn = intOp ss Add x y
92 | isDict semiringInt dict && isFn fnAdd fn = intOp ss Add x y
91 | isDict semiringInt dict && isFn fnMultiply fn = intOp ss Multiply x y
93 | isDict semiringInt dict && isFn fnMultiply fn = intOp ss Multiply x y
@@ -100,6 +102,7 @@ inlineCommonValues = everywhereOnJS convert
100 fnDivide = (C.dataEuclideanRing, C.div)
102 fnDivide = (C.dataEuclideanRing, C.div)
101 fnMultiply = (C.dataSemiring, C.mul)
103 fnMultiply = (C.dataSemiring, C.mul)
102 fnSubtract = (C.dataRing, C.sub)
104 fnSubtract = (C.dataRing, C.sub)
105+ fnNegate = (C.dataRing, C.negate)
103 intOp ss op x y = JSBinary ss BitwiseOr (JSBinary ss op x y) (JSNumericLiteral ss (Left 0))
106 intOp ss op x y = JSBinary ss BitwiseOr (JSBinary ss op x y) (JSNumericLiteral ss (Left 0))
105inlineCommonOperators :: JS -> JS
108inlineCommonOperators :: JS -> JS
@@ -109,8 +112,6 @@ inlineCommonOperators = applyAll $
110 , binary ringNumber opSub Subtract
113 , binary ringNumber opSub Subtract
111 , unary ringNumber opNegate Negate
114 , unary ringNumber opNegate Negate
112− , binary ringInt opSub Subtract
113− , unary ringInt opNegate Negate
115 , binary euclideanRingNumber opDiv Divide
116 , binary euclideanRingNumber opDiv Divide
116 , binary euclideanRingInt opMod Modulus
117 , binary euclideanRingInt opMod Modulus