Hi, On Tue, Oct 6, 2009 at 2:37 AM, Henning Thielemann <lemm...@henning-thielemann.de> wrote: > Numeric literals are treated as Integer or Rational, and are then converted > with the function fromInteger or fromRational, respectively, to the required > type. Whatever fromInteger function is in scope, will be used. If > fromInteger is in a class other than Num (in NumericPrelude it is Ring, but > it can be also a function that is not a class method), then number literals > have a type like: > 2 :: MyNumClass a => a
This is only the case if you use GHC's NoImplicitPrelude extension, otherwise the "fromInteger" of the Prelude is used, even if it is not in scope. Here is an example: module A where boolLit :: Integer -> Bool boolLit 0 = False boolLit _ = True {-# LANGUAGE NoImplicitPrelude #-} module Main where import A(boolLit) import Prelude(Integer,Bool,print) fromInteger :: Integer -> Bool fromInteger = boolLit main = print 0 Note that 0 means different things in the different modules! -Iavor _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe