[Haskell-beginners] general observation about programming

Jeffrey Brown jeffbrown.the at gmail.com
Sat Feb 27 20:56:36 UTC 2016


It is, I agree, not appropriate everywhere, but point-free code can in the
right place be much more readable. Maps are a good example. Compare:

    map (f . g . h) xs

to

    map (\x -> f $ g $ h x) xs


On Fri, Feb 26, 2016 at 10:17 PM, Rustom Mody <rustompmody at gmail.com> wrote:

>
>
> On Fri, Feb 26, 2016 at 11:11 PM, Rein Henrichs <rein.henrichs at gmail.com>
> wrote:
>
>> Pointfree is good for reasoning about *composition*. It can often be
>> more readable than pointful code when the focus of the function is on
>> composition of other functions. For example, take this function from Bird's *Pearls
>> of Functional Algorithm Design*:
>>
>>  boxes = map ungroup . ungroup . map cols . group . map group
>>
>
> And better if you read it in the right (ie left to right order)
>
>
> boxes  =  map group >>> group >>> map cols >> ungroup >>> map ungroup
> (From Control.Arrow)
>
> 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)
> [Those who find this unnatural/difficult/arcane/etc may like to check out
> Unix-pipes (or English :-) ]
>
> Some wishful thinking in the same direction
> (uses python but python is not really relevant)  :
> http://blog.languager.org/2014/04/unicoded-python.html
> Which to some extent I found works in Haskell :
> http://blog.languager.org/2014/05/unicode-in-haskell-source.html
> If only Haskell would go further!!
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
>


-- 
Jeffrey Benjamin Brown
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20160227/456db631/attachment.html>


More information about the Beginners mailing list