In the following picture we see that RealFloat is an instance of Floating, which in turn is an instance of Fractional etc...
For any type class in Haskell how can we find all the "parents" ?
Just use the ghci interpreter. To demonstrate your example:
λ> :i RealFloat
class (RealFrac a, Floating a) => RealFloat a where
floatRadix :: a -> Integer
floatDigits :: a -> Int
.....
instance Floating Float -- Defined in `GHC.Float'
instance Floating Double -- Defined in `GHC.Float'
λ> :i Floating
class Fractional a => Floating a where
pi :: a
exp :: a -> a
.....
From the above example, you can see how RealFloat
is related to RealFrac
and Floating
and how Floating
is related to Fractional
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With