7

If I enter ":i Double" or ":i Float" in ghci, it says that Double and Float are instances of Fractional. But in the Haskell docs it says that they aren't. So are they or not? http://hackage.haskell.org/package/base-4.9.1.0/docs/Prelude.html#t:Fractional

2
  • 3
    They are -- :i is reliable, they are listed as instances of Floating (which has Fractional as superclass), and if you go to the source code for Double's Floating instance you will find the Fractional one a few lines above. This does look like a documentation/Haddock bug of some sort, though -- the instances should have been listed there.
    – duplode
    Feb 9, 2017 at 23:21
  • 4
    (This seems to be a known Haddock bug -- cf. Haddock issue #372.)
    – duplode
    Feb 10, 2017 at 0:03

1 Answer 1

11
  • Double and Float are a part of RealFloat,
    • which extends RealFrac and Floating;
      • both of which extend Fractional.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.