Deprecating fromIntegral
Jon Fairbairn
jon.fairbairn at cl.cam.ac.uk
Thu Sep 28 08:38:03 UTC 2017
Niklas Hambüchen <mail at nh2.me> writes:
>> I'm -1 on deprecating it, and +1 on adding additional conversion
>> functions of various sorts: explicit widening, explicit narrowing, etc.
>
> What is your reasoning against deprecating it?
May I just interject that fromIntegral itself is not the
problem. There’s nothing wrong with “fromIntegral 5::Ratio
Integer” for example. The problem is having the type “(Num b,
Integral a) => a->b”, which drags in all the horror that is Num.
A type more like “(Integral a, InfinitePrecisionNumber b) => a
-> b” (and an appropriate definition of the class) would allow
its continued use in places where it’s safe.
--
Jón Fairbairn Jon.Fairbairn at cl.cam.ac.uk
More information about the Libraries
mailing list