git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
C++: fix float literal inlining
commit2dbc14dba9421f3f99a624b15bf03aee3e01848b authorAndy Arvanitis <andyarvanitis@gmail.com> dateMon 6 Feb 2017, 09:10 (10 years ago) parent06709aa
1 file changed+4−2
src/Language/PureScript/CodeGen/Cpp/Optimizer/Inliner.hs+4−2
src/Language/PureScript/CodeGen/Cpp/Optimizer/Inliner.hs+4−2
@@ -108,8 +108,10 @@ inlineCommonValues = everywhereOnCpp convert
108108 where
109109 convert :: Cpp -> Cpp
110110 convert (CppApp fn [dict])
111− | isDict' [semiringNumber, semiringInt] dict && isFn fnZero fn = CppNumericLiteral (Left 0)
112− | isDict' [semiringNumber, semiringInt] dict && isFn fnOne fn = CppNumericLiteral (Left 1)
111+ | isDict semiringInt dict && isFn fnZero fn = CppNumericLiteral (Left 0)
112+ | isDict semiringInt dict && isFn fnOne fn = CppNumericLiteral (Left 1)
113+ | isDict semiringNumber dict && isFn fnZero fn = CppNumericLiteral (Right 0.0)
114+ | isDict semiringNumber dict && isFn fnOne fn = CppNumericLiteral (Right 1.0)
113115 | isDict boundedBoolean dict && isFn fnBottom fn = CppBooleanLiteral False
114116 | isDict boundedBoolean dict && isFn fnTop fn = CppBooleanLiteral True
115117 convert (CppApp (CppApp fn [dict]) [x])