[Haskell-cafe] Smarter do notation

Thomas Schilling nominolo at googlemail.com
Mon Sep 5 23:41:02 CEST 2011


On 5 September 2011 15:49, Sebastian Fischer <fischer at nii.ac.jp> wrote:
>
> On Mon, Sep 5, 2011 at 10:19 PM, Thomas Schilling <nominolo at googlemail.com> wrote:
>>>
>>> a >>= \p -> f <$> b -- 'free p' and 'free b' disjoint
>>>  -->
>>> ((\p -> f) <$> a) <*> b
>>
>> Will there also be an optimisation for some sort of simple patterns?  I.e., where we could rewrite this to:
>>   liftA2 (\pa pb -> f ...) a b
>> I think I remember someone saying that the one-at-a-time application of <*> inhibits certain optimisations.
>
> liftA2 is defined via one-at-a-time application and cannot be redefined because it is no method of Applicative. Do you remember more details?

Good point.  I can't find the original post, so I don't know what
exactly the issue was (or maybe I'm misremembering).

--
Push the envelope. Watch it bend.



More information about the Haskell-Cafe mailing list