Yes indeed, I realized that. I oversimplified my question. I'm basically trying to model 4D CG/HLSL operations (pixel/vertex shaders) in Haskell.
I tried realToFrac, but that did not work. Then I tried splitting the instances into Fractional and Integral, but I kept getting errors. Maybe because I also made the Vector datatype an instance of Num, Fractional, etc, which was needed to model the CG/HLSL piecewise operations (so multiplication of two vectors is done piecewise by default in the CG model; one has special dot, cross, and mul operations for performing the other operations). Anyway, although I got something working when I enabled many GHC extensions, I dropped it for now. I notice that a lot of Haskell code uses type annotations (e.g. in HOpenGL), so I guess that's the price one has to pay. It would be nice if one could have a full predicate in the constraints section of a type class, like class ((Num a) && not (Vector4D a)) => ... But I guess this indicates bad design? Thanks, Peter [EMAIL PROTECTED] wrote: How can you hope to convert an arbitrary Num to a Float? Num contains things like complex numbers that don't have any reasonable translation to a Float. But anyway, realToFrac is a good conversion function. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe