@@ -86,6 +86,8 @@ inlineCommonValues = everywhereOnJS convert
8686 | isDict' [semiringNumber, semiringInt] dict && isFn fnOne fn = JSNumericLiteral ss (Left 1 )
8787 | isDict boundedBoolean dict && isFn fnBottom fn = JSBooleanLiteral ss False
8888 | 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 ))
8991 convert (JSApp ss (JSApp _ (JSApp _ fn [dict]) [x]) [y])
9092 | isDict semiringInt dict && isFn fnAdd fn = intOp ss Add x y
9193 | isDict semiringInt dict && isFn fnMultiply fn = intOp ss Multiply x y
@@ -100,6 +102,7 @@ inlineCommonValues = everywhereOnJS convert
100102 fnDivide = (C. dataEuclideanRing, C. div )
101103 fnMultiply = (C. dataSemiring, C. mul)
102104 fnSubtract = (C. dataRing, C. sub)
105+ fnNegate = (C. dataRing, C. negate )
103106 intOp ss op x y = JSBinary ss BitwiseOr (JSBinary ss op x y) (JSNumericLiteral ss (Left 0 ))
104107
105108inlineCommonOperators :: JS -> JS
@@ -109,8 +112,6 @@ inlineCommonOperators = applyAll $
109112
110113 , binary ringNumber opSub Subtract
111114 , unary ringNumber opNegate Negate
112- , binary ringInt opSub Subtract
113- , unary ringInt opNegate Negate
114115
115116 , binary euclideanRingNumber opDiv Divide
116117 , binary euclideanRingInt opMod Modulus
0 commit comments