我试图了解为什么会出现以下错误,
add (Erf prob) to the context of the instance declaration
我有一个使用erf
from的简单实例Data.Number.Erf
instance (Floating prob) => CDF (Normal prob) where
cdf dist dp = ( 0.5 * ( 1 + erf ( (x - mu)/ (sqrt $ sigma2 *2) )))
但是 ghc-7.6.3 会抱怨上述问题,一个可能的解决方法是更改instance (Floating prob)
为instance(Floating prob, Erf prob)
任何人都可以解释为什么需要这样做吗?`