]> gitweb.michael.orlitzky.com - numerical-analysis.git/blobdiff - src/Integration/Trapezoid.hs
Fix a bunch of hlint warnings.
[numerical-analysis.git] / src / Integration / Trapezoid.hs
index 444d92d2eb9a0ed2e6911970f54cd88aafd71b3a..06350fcf54a70da55ac317610c1a7dca2f3b8a62 100644 (file)
@@ -38,8 +38,9 @@ trapezoid_1 :: (Field.C a, ToRational.C a, Field.C b)
             -> a       -- ^ The \"right\" endpoint, @b@
             -> b
 trapezoid_1 f a b =
-  (((f a) + (f b)) / 2) * (fromRational' $ toRational (b - a))
-
+  (((f a) + (f b)) / 2) * coerced_interval_length
+  where
+    coerced_interval_length = fromRational' $ toRational (b - a)
 
 -- | Use the composite trapezoid rule to numerically integrate @f@
 --   over @n@ subintervals of [@a@, @b@].