[Haskell-beginners] Setting Default Integer and Real Types
byorgey at seas.upenn.edu
Wed Sep 8 08:04:18 EDT 2010
On Wed, Sep 08, 2010 at 12:58:48PM +0200, Lorenzo Isella wrote:
> Dear All,
> I am quite new to Haskell and planning to see where it will lead me
> in scientific computing (I will be looking into hmatrix soon).
> Unless there are real memory problems, I would like to make sure that
> all real numbers are Double and all integer numbers are Integer
> Now, I understand that Haskell in most of the cases is smart enough
> to infer the type of a variable (integer, real, etc...), but can I
> also set its default precision once for all?
> I.e. if I say a=5.2 I want a to be used as a double precision real
> everywhere in the code.
Sure, just give a type signature:
a :: Double
a = 5.2
More information about the Beginners