[Haskell-cafe] coercion to Int

2005-01-02 Thread lothar
what coercion can i use to get the below program to compile? i see class (Real a, Fractional a) = RealFrac a where round :: (Integral b) = a - b and class (Fractional a) = Floating a where sqrt :: a - a fillK_ :: Int - Int fillK_ x = round (sqrt x) -- line 2

[Haskell-cafe] coercion to Int

2005-01-02 Thread james pentland
what coercion can i use to get the below program to compile? i see class (Real a, Fractional a) = RealFrac a where round :: (Integral b) = a - b and class (Fractional a) = Floating a where sqrt :: a - a fillK_ :: Int - Int fillK_ x = round (sqrt x) -- line

[Haskell-cafe] coercion to Int

2004-12-31 Thread james pentland
what coercion can i use to get the below program to compile? i see class (Real a, Fractional a) = RealFrac a where round :: (Integral b) = a - b and class (Fractional a) = Floating a where sqrt :: a - a various combinations of fromInteger, toInteger do not help.

Re: [Haskell-cafe] coercion to Int

2004-12-31 Thread Stefan Holdermans
James, Untested: fnK_ :: Int - Int fnK_ n = round (sqrt $ fromInteger x :: Double) HTH, Stefan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] coercion to Int

2004-12-31 Thread Lennart Augustsson
fnK_ :: Int - Int fnK_ = round . sqrt . fromIntegral james pentland wrote: what coercion can i use to get the below program to compile? i see class (Real a, Fractional a) = RealFrac a where round :: (Integral b) = a - b and class (Fractional a) = Floating a where sqrt

Re: [Haskell-cafe] coercion to Int

2004-12-31 Thread Thomas Hallgren
james pentland wrote: what coercion can i use to get the below program to compile? ... various combinations of fromInteger, toInteger do not help. Did you try fromIntegral? fromIntegral :: (Integral a, Num b) = a - b fnK_ :: Int - Int fnK_ x = round (sqrt x) -- line 2 -- Thomas H