On Mon, 13 Jul 1998, Eric Blough wrote:

> Alastair Reid writes:
>  > [EMAIL PROTECTED] (S.D.Mechveliani) writes:
>  > > Recent Haskell ignores the possibility of the automatic type 
>  > > conversion. Thus, 
>  > >                           1 + 1%2  
>  > > is ill-typed.
>  > 
>  > and goes on to propose a fix.
>  > 
>  > This expression is perfectly well typed: Hugs 1.4 accepts it without
...
> I think that Sergey is offering a proposal for numeric type coercion,
> such that (for example) for n :: Int and x :: Float, n*x will be well
> typed, without the need to write (fromInteger n)*x.

To add my 2c... I think the original proposal was a general scheme for
defining `implicit coercions' via a multiparameter typeclass construction
which is treated specially by the compiler, and numeric conversions were
the particular motivating example. 

I've no problems with this in principle but would like some way of
ensuriing that, if I were using other people's code, I could ensure that
all their implicit conversions are securely locked away in their modules
only, even if constructors for which they are defined have been exported
into my code. In particular, although it is sometimes a nuisance I prefer
Haskell's complaints about mixing Ints, Floats, etc..., to C's automatic
conversions which mean that trivial typos can completely corrupt numerical
components of a program without any compiler warnings. (I'm afraid I come
from a `formal methods' background and truly believe that I'm barely able
to mentally handle programming reliably and WANT the system to point out
all the obvious things I might have done wrong even if they have make
sense after some sequence of implicit conversions.) So I'd want to be able
to be sure that numbers are treated as currently within any code I write,
regardless of what any other modules may do. 

___cheers,_dave__________________________________________________________
email: [EMAIL PROTECTED]       "valid PERL regexp: text not produced by
www.cs.bris.ac.uk/~tweed/pi.htm     any of infinitely many monkeys after
work tel: (0117) 954-5253           an infinitely long time." 


Reply via email to