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

2006-11-23 Thread isto
Hi thanks! to, 2006-11-16 kello 14:02 -0800, Greg Buchholz kirjoitti: ] I'll guess the reason it didn't compile was different ] types at case branches (am I wrong?) Correct. ] Anyhow, do you know that is it possible to choose the return type ] somehow in the spirit above?

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

2006-11-23 Thread John Meacham
On Thu, Nov 16, 2006 at 10:44:59PM +0200, isto wrote: 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? GADTs let you do this. And they even omit the

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

2006-11-16 Thread isto
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? yes, I was blind... Thanks! I'll guess

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

2006-11-16 Thread Greg Buchholz
isto wrote: ] isto wrote: ] ] let t = show (typeOf a) ] ] in case t of ] ] Double - roundDDec d a ] ] Complex Double - roundCDec d a ] ] I'll guess the reason it didn't compile was different ] types at case branches (am I wrong?) Correct. ] Anyhow, do you know

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

2006-11-15 Thread isto
Hi, I've been trying to compile the following function (rounding to a desired degree): roundDec :: (Num a, Typeable a) = Int - a - a roundDec d a = let t = show (typeOf a) in case t of Double - roundDDec d a Complex Double - roundCDec d a

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

2006-11-15 Thread Greg Buchholz
isto wrote: ] I've been trying to compile the following function ] (rounding to a desired degree): ] ] roundDec :: (Num a, Typeable a) = Int - a - a ] roundDec d a = ] let t = show (typeOf a) ] in case t of ] Double - roundDDec d a ] Complex Double -