Flipped function application

Dag Odenhall dag.odenhall
Fri Oct 11 15:02:26 UTC 2013


I like (&) better than (#) because it reads like x and apply f to it, but I
could probably get used to (#) too.

I'm (still) +1 to adding a single-character operator to Data.Function, FWIW.


On Fri, Oct 11, 2013 at 11:13 AM, Heinrich Apfelmus <
apfelmus at quantentunnel.de> wrote:

> Simon Peyton-Jones wrote:
>
>> I quite like that.  ($$), that is.  Better than (&)
>>
>> Simon
>>
>> | > 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,
>>
>
> I strongly prefer (#) . It's used by the diagrams [1] library
>
>    example1  =   circle 1 # fc red   # lw 0
>              ||| circle 1 # fc green # lw 0
>
> and by my own threepenny-gui package [2]
>
>    example2 = do
>         button <- UI.button # set text "Doorbell"
>         status <- UI.span
>                   # set text "Thinking"
>                   # set style [("color","blue")]
>
>         on UI.click button $ do
>             element status # set text "Disturbed"
>
>
> A year ago, I might have opposed the proposal altogether, but diagrams has
> convinced me that it's quite useful. In particular, I think it's great when
> you want to put the emphasis on the argument and treat the functions as
> styling. For instance, in  example2  , the focus is on the fact that
>  status  is a new span element, whereas the specific styling of the span is
> secondary.
>
> In my opinion, only (#) looks "right" for this purpose, though.
>
> I don't think it's a good idea to add it to the Prelude, but I would
> appreciate it in Data.Function or thelike.
>
>
>   [1]: http://hackage.haskell.org/**package/diagrams<http://hackage.haskell.org/package/diagrams>
>   [2]: http://www.haskell.org/**haskellwiki/Threepenny-gui<http://www.haskell.org/haskellwiki/Threepenny-gui>
>
> Best regards,
> Heinrich Apfelmus
>
> --
> http://apfelmus.nfshost.com
>
>
> ______________________________**_________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/**mailman/listinfo/libraries<http://www.haskell.org/mailman/listinfo/libraries>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20131011/7ebe37bf/attachment.html>




More information about the Libraries mailing list