X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=src%2FRealFunction.hs;h=37babf6b7fc351c1ac6621b2eaa4ce0e8962b056;hb=83ef0aaeae074756e4ee90d72d3e27e74e136061;hp=01e34bdf39d086e7dbced9690ba6c7a891cda844;hpb=8c7f684c5b1a6941a552d2101aff70fe1f9a23ec;p=spline3.git diff --git a/src/RealFunction.hs b/src/RealFunction.hs index 01e34bd..37babf6 100644 --- a/src/RealFunction.hs +++ b/src/RealFunction.hs @@ -1,13 +1,15 @@ +{-# OPTIONS_GHC -Wno-orphans #-} {-# LANGUAGE FlexibleInstances #-} module RealFunction ( RealFunction, cmult, - fexp - ) + fexp ) where - +-- Presumably this is faster without a newtype wrapper, and that's why +-- we're about to define a bunch of orphan instances below. Note the +-- GHC pragma thingy at the top of this file to ignore those warnings. type RealFunction a = (a -> Double) @@ -71,5 +73,5 @@ cmult coeff f = (*coeff) . f -- fexp :: (RealFunction a) -> Int -> (RealFunction a) fexp f n - | n == 0 = (\_ -> 1) + | n == 0 = const 1 | otherwise = \x -> (f x)^n