Flipped function application

Wvv vitea3v
Thu Oct 10 17:08:25 UTC 2013


We want to combine all of them, like

xs # map $ (+ 3) . snd  

And xs $$ map $ (+ 3) . snd  - don't look nice.
By the way, ($$) is already heavy use at pretty, conduit, enumerator,
snap-core


By the way, in OCaml we have next syntax for objects: 
object #field
so, (#) isn't against ML

In Data.Sequence is already defined (|>), (<|) and (:>). But not (<:)
In Platform, fgl package, Data.Graph.Inductive.Graph is already defined (&).

If there are many disadvantages to use (#), (&) or (|>) we could use
something more neutral, like (.:) :

xs .: map $ (+ 3) . snd  

(.:) is free. It is only use in some packages, like aeson.





David Menendez-2 wrote
> On Thu, Oct 10, 2013 at 10:13 AM, Dan Doel <

> dan.doel@

> > wrote:
> 
>> On Thu, Oct 10, 2013 at 4:46 AM, Simon Peyton-Jones
>> <

> simonpj@

> > wrote:
>> > F# uses (|>).   Maybe (#) is good.    To me (&) looks too commutative
>> > because it?s usually used for conjunction.
>>
>> I mentioned this on the core list, but I'll mention it here, too:
>>
>> I don't like (|>), because once you have this operator, you also might
>> as well have the functorial version. We have ($) and (<$>), and lens
>> has (&) and (<&>). The latter is useful for functorial 'for blocks':
>>
>>     myFunctorValue <&> \x ->
>>       ...complex expression...
>>
>> I actually think it's (significantly) more useful than (&). But, I
>> think (<|>>) is a pretty awful name for it, so I'd prefer a name that
>> makes both palatable.
> 
> 
> I'm still not convinced we need flipped application in general[1], and I'm
> sure we don't need new name suggestions at this point, but:
> 
> Consider <**> :: f a -> f (a -> b) -> f b.
> 
> That suggests <$$> :: f a -> (a -> b) -> f b by analogy, so maybe $$ :: a
> -> (a -> b) -> b? This avoids the downsides of & while maybe being less
> ugly to combine with things than |>. Also, it looks like $, suggesting
> they're related.
> 
> 
> [1]: Although it's certainly convenient for some idioms, like working with
> lenses.
> 
> 
> -- 
> Dave Menendez <

> dave@

> >
> <http://www.eyrie.org/~zednenem/>
> 
> _______________________________________________
> Libraries mailing list

> Libraries@

> http://www.haskell.org/mailman/listinfo/libraries





--
View this message in context: http://haskell.1045720.n5.nabble.com/Flipped-function-application-tp5738131p5738204.html
Sent from the Haskell - Libraries mailing list archive at Nabble.com.




More information about the Libraries mailing list