
14 Dec
2010
14 Dec
'10
1:31 p.m.
Hi, Is there something like an identity type, transparent to the type-checker, in haskell ? For instance, I'm defining an interval arithmetic, with polynomials, matrices, and all that... defined with intervals. The types are : Polynomial Interval (instead of Polynomial Double for instance) Matrix Interval etc. Now I'd like to be able to define some typeclass "intervalize" that would convert a IEEE-754 version of my types into the interval ones : class Intervalize a where intervalize::a Double-> a Interval Wouldn't it be very natural wanting to use this class on Doubles directly : intervalize' :: Double->Interval intervalize'=intervalize Does this exist in haskell ? in GHC ? Cheers, Pierre