#2309: containers: specialize functions that fail in a Monad to
iavor.diatchki at gmail.com
Thu May 29 12:42:08 EDT 2008
I also like Maybe---it is simpler, it is what you want most of the time.
On Thu, May 29, 2008 at 6:57 AM, Jonathan Cast
<jonathanccast at fastmail.fm> wrote:
> 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 Num,
>>> 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.
> Libraries mailing list
> Libraries at haskell.org
More information about the Libraries