[Haskell-beginners] general observation about programming

Michael Orlitzky michael at orlitzky.com
Sun Feb 28 02:53:14 UTC 2016


On 02/27/2016 08:35 PM, Henk-Jan van Tuyl wrote:
>>
>> Even better if the 3-char clunky >>> is reduced to the 1-char ⋙
>> map group ⋙ group ⋙ map cols ⋙ ungroup ⋙ map ungroup
>> (From Control.Arrow.Unicode)
> 
> You can also use & from Data.Function (since base 4.8.0.0)
>    map group & group & map cols & ungroup & map ungroup
> 

I would love to hear the elevator pitch for making "and" mean "backwards
function application". Might as well go full retard:

  boxes m =
    m & ((⋘ ungroup . map cols <<< group >>> map group) $ map ungroup)

As you can see, it gets more clear the more operators you use. Note that
(&) isn't backwards composition -- it's backwards application. So it's
analogous to "$" and not the "." operator. You can just google "&" to
find that out though.



More information about the Beginners mailing list