fromInteger package:numhask

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.