The Haskell library
cmath includes special functions like the error function, erf. There are also pure Haskell implementations of the error function. The advantage of the code below is that you can copy and paste it into your project and avoid any external dependencies. See also Relating erf and Φ.
erf :: Double -> Double erf x = sign*y where a1 = 0.254829592 a2 = -0.284496736 a3 = 1.421413741 a4 = -1.453152027 a5 = 1.061405429 p = 0.3275911 -- Abramowitz and Stegun formula 7.1.26 sign = if x > 0 then 1 else -1 t = 1.0/(1.0 + p* abs x) y = 1.0 - (((((a5*t + a4)*t) + a3)*t + a2)*t + a1)*t*exp(-x*x) test_erf :: Bool test_erf = maximum [ abs(erf x - y) | (x, y) <- zip xs ys ] < epsilon where epsilon = 1.5e-7 -- accuracy promised by A&S xs = [-3, -1, 0.0, 0.5, 2.1 ] ys = [-0.999977909503, -0.842700792950, 0.0, 0.520499877813, 0.997020533344]