[Haskell-cafe] Identity type

Pierre-Etienne Meunier pierreetienne.meunier at gmail.com
Tue Dec 14 19:31:14 CET 2010


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

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

Does this exist in haskell ? in GHC ?


More information about the Haskell-Cafe mailing list