Richard A. O'Keefe comments :
Sounds like you want NumericPrelude.
(Or possibly the AXIOM computer algebra language...)

Just a word.
This is a quite old subject, "reinvented" many times. A neverending story...

Already twenty (yes!) years ago, in:

Functional programming languages in education : first international symposium, FPLE '95, Nijmegen, the Netherlands, December 4-6, 1995

you may find two talks about it, one by  Jeroen Fokker, and other, mine.

Then, Sergei Mechveliani worked some years on it, and constructed DoCon, the Algebraic Domain Constructor (accessible here:
http://homepages.inf.ed.ac.uk/wadler/realworld/docon2.html )

Presumably there are other implementations as well. I know, but I lost the references, that some people worked on such constructs in Clean, where the type class structure is a bit different than in Haskell, some generalizations are easier to implement.

Jerzy Karczmarczuk