What does the type of number literals mean, e.g.
5 :: Num a => a (or more verbosely:
5 :: forall a. Num a => a)?
n :: Num a => a as saying:
n has any type whatsoever, as long as that type is an instance of the
Haskell will always give the most general typeclass that supports the numeric operations you are using:
(+)is an operation supported by the
(/)is an operation supported by
Fractional, a class that inherits from
(**)is an operation supported by
Floating, a class that inherits from
Like all universally quantified values, a value of type
forall a. Num a => a can be given as input to any function that takes an concrete number type:
Created: August 18, 2022