No safety in numbers

Konrad Hinsen hinsen@cnrs-orleans.fr
Thu, 21 Aug 2003 23:08:34 +0200


On Thursday 21 August 2003 22:42, Jon Cast wrote:

> > (or any other type I declare it to be).
>
> Right.  But: you can declare it to have type Fractional alpha =3D> alph=
a,
> which is the same type the constant has in the middle of an expression.

I can make such a declaration, but it still gets converted to Double.

What I can do is turn my constant table into a function:

constant :: Fractional a =3D> String -> a
constant "k_B: =3D 0.0083144708636327096

and have the return values be of type Fractional a =3D> a. But I suppose =
there=20
is some runtime cost associated with such a function call, so I would rat=
her=20
avoid it.

Konrad.