]> gitweb.michael.orlitzky.com - numerical-analysis.git/commitdiff
src/ODE/IVP.hs: fix monomorphism restriction warning.
authorMichael Orlitzky <michael@orlitzky.com>
Fri, 7 Dec 2018 15:45:06 +0000 (10:45 -0500)
committerMichael Orlitzky <michael@orlitzky.com>
Fri, 7 Dec 2018 15:45:06 +0000 (10:45 -0500)
src/ODE/IVP.hs

index 6f798f46846a44ef4006145a440f87837cf0a2cc..5bffe08cfff387210c3bdd7cc3f5483dba81c13e 100644 (file)
@@ -34,7 +34,7 @@ import qualified Algebra.RealField as RealField ( C )
 --   >>> eulers_method1 x0 y0 f h
 --   2.0
 --
 --   >>> eulers_method1 x0 y0 f h
 --   2.0
 --
-eulers_method1 :: (Field.C a, ToRational.C a, Field.C b)
+eulers_method1 :: forall a b. (Field.C a, ToRational.C a, Field.C b)
                => a -- ^ x0, the initial point
                -> b -- ^ y0, the initial value at x0
                -> (a -> b -> b) -- ^ The function f(x,y)
                => a -- ^ x0, the initial point
                -> b -- ^ y0, the initial value at x0
                -> (a -> b -> b) -- ^ The function f(x,y)
@@ -43,7 +43,7 @@ eulers_method1 :: (Field.C a, ToRational.C a, Field.C b)
 eulers_method1 x0 y0 f h =
   y0 +  h'*y'
   where
 eulers_method1 x0 y0 f h =
   y0 +  h'*y'
   where
-    h' = fromRational'$ toRational h
+    h' = fromRational'$ toRational h :: b
     y' = (f x0 y0)
 
 
     y' = (f x0 y0)