#2309: containers: specialize functions that fail in a Monad to Maybe

Neil Mitchell ndmitchell at gmail.com
Thu May 29 04:30:51 EDT 2008


Hi

>> Following this line of reasoning: why is  1  syntactic sugar for
>>  fromIntegral 1? If 1 has type Integer then the generic value is just a
>> fromIntergal away!
>
> That's a good point the other way --- I suspect, like most things Num,
> numeric literals were rather grand-fathered in than designed intentionally
> that way.

fromIntegral is essential if you have two "integer" types, namely Int
and Integer. If you are looking for something to blame, then its the
premature optimisation that is Int. Int is really just a performance
hack around Integer.

Of course, we all want the performance of Int, so I'm not saying its a
bad thing. But one hack often leads to another.

Thanks

Neil


More information about the Libraries mailing list