[Haskell-cafe] Is 'flip' really necessary?

Max Rabkin max.rabkin at gmail.com
Mon Jul 26 17:25:27 EDT 2010


On Mon, Jul 26, 2010 at 10:42 PM, Nils <ml at n-sch.de> wrote:
> On 26.07.2010 08:33, David Virebayre wrote:
>>
>> listeEtagTot = concatMap (`listeEtagArm` cfgTypesTringle) listeArmOrd
>
> You can use flip as a "wildcard" aswell:
>
>> listeEtagTot = concatMap (listeEtagArm `flip` cfgTypesTringle) listeArmOrd
>
> Makes it even more readable in my opinion, since this really "shows" you
> where the value belongs to.

It took me a fair while (I'm talking on the order of half a minute) to
figure out what that meant, but it's pretty cool. Maybe a different
name would be better? How about (??) or "it"?

> listeEtagTot = concatMap (listeEtagArm ?? cfgTypesTringle) listeArmOrd
> listeEtagTot = concatMap (listeEtagArm `it` cfgTypesTringle) listeArmOrd

--Max


More information about the Haskell-Cafe mailing list