#2309: containers: specialize functions that fail in a Monad to
jonathanccast at fastmail.fm
Thu May 29 09:57:48 EDT 2008
On 29 May 2008, at 1:30 AM, Neil Mitchell wrote:
>>> 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
>> numeric literals were rather grand-fathered in than designed
>> 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.
Um, that de-railed quickly... ‘fromIntegral’ in the original is a
typo or mis-understanding for ‘fromInteger’. My comment was re:
implicit fromInteger (and polymorphic numeric literals). GP was
arguing for making Map.lookup polymorphic in the failure monad; I
replied I thought, in the case of numeric literals, that no-one
designing Haskell without the tradition that 3 `member` IR, no-one
would have thought that 3 :: Integer and 3 :: Double both made
sense. Explicit conversions are not really the issue here.
More information about the Libraries