Possible Duplicate:
Return specific type within Haskell
This code:
class Alpha a where
half :: Real f => a -> f
instance Alpha Double where
half a = a/2.0
produces this error:
rigid.hs:6:13:
Couldn't match expected type `f' against inferred type `Double'
`f' is a rigid type variable bound by
the type signature for `half' at rigid.hs:3:17
In the expression: a / 2.0
In the definition of `half': half a = a / 2.0
In the instance declaration for `Alpha Double'
Failed, modules loaded: none.
Why?
EDIT: Figuring out the business of rigid type, I think I've arrived at a more focused question. How do I convert a Double into a value that satisfies Ord and Num? That is, a function that gets me (Ord a, Num a) => Double -> a
?