On Mon, 5 Oct 2009, Jason Dagit wrote:

2. How can i use numeric literals to construct values, whose types are not
in
the Num class?

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

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to