fromInteger -package:semirings

Conversion from an Integer. An integer literal represents the application of the function fromInteger to the appropriate value of type Integer, so such literals have type (Num a) => a.
synonym for integralFromProxy, kept for backward compatibility
Convert number of nanoseconds to T
Replacement for fromInteger using the RebindableSyntax extension. This version of fromInteger arranges that integer literals are always of type Integer.
fromInteger is special in two ways:
  • numeric integral literals (like "42") are interpreted specifically as "fromInteger (42 :: GHC.Num.Integer)". The prelude version is used as default (or whatever fromInteger is in scope if RebindableSyntax is set).
  • The default rules in haskell2010 specify that constraints on fromInteger need to be in a form C v, where v is a Num or a subclass of Num.
So a type synonym such as type FromInteger a = FromIntegral a Integer doesn't work well with type defaulting; hence the need for a separate class.
Construct the number from the associated integer.