[Haskell-cafe] Smarter do notation

Sebastian Fischer fischer at nii.ac.jp
Mon Sep 5 16:49:39 CEST 2011


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?


> I find (a << b) confusing.  The intended semantics seem to be "effect a",
> then "effect b", return result of "a".
>

Sorry, I didn't know that << doesn't exist. I meant an operator with the
meaning of <* .

Sebastian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110905/9d5e59f0/attachment.htm>


More information about the Haskell-Cafe mailing list