
On Fri, Aug 21, 2009 at 2:02 PM, Miguel Mitrofanov
{-# LANGUAGE UndecidableInstances #-}
Ouch!
Don't worry, it's just me not liking UndecidableInstances.
Without it, GHC doesn't like the 'Arg f ~ b' constraint not being smaller than the instance head in: instance (ModelFunc f, Arg f ~ b) => ModelFunc (b -> f) where ...
So instead of passing the parameters as a list I want to pass them as arguments:
\x p1 p2 p3 -> p1*x^2 + p2*x + p3
Why not use tuples?
\x (p1, p2, p3) -> p1 * x^2 + p2 * x + p3
Or a special list-like data type
data a :* b = ($*) a b
func :: Double -> (Double :* Double :* Double) -> Double func x (p1 $* p2 $* p3) = p1 * x^2 + p2 * x + p3
What will the type of 'levmarHL' look like using tuples or using your special list-like type? Thanks, Bas