[Haskell-cafe] type keeping rounding, typeable (and a difficulty)

isto isto.aho at dnainternet.net
Thu Nov 16 15:44:59 EST 2006


ke, 2006-11-15 kello 13:31 -0800, Greg Buchholz kirjoitti:
> isto wrote:
> ] 	let t = show (typeOf a)
> ] 	in case t of
> ] 		"Double"  -> roundDDec d a
> ] 		"Complex Double" -> roundCDec d a

>     Maybe you want type classes instead?

aaaa yes, I was blind... Thanks! 

I'll guess the reason it didn't compile was different
types at case branches (am I wrong?) Anyhow, do you know that 
is it possible to choose the return type somehow in the spirit 
above?  

br, Isto




More information about the Haskell-Cafe mailing list