[Haskell-beginners] foldr point free notation

Apoorv Ingle apoorv.ingle at gmail.com
Wed Jun 10 15:50:27 UTC 2020


Hi Alexander,

I found this tool online[1], that converts your function to a point free style.

myAny'' f = foldr (\a b -> f a || b) False

is transformed to

myAny'' = flip foldr False . ((||) .)

Again as Bob mentions, the point free style comes at a cost of unreadability and hence unmaintainable. 

Cheers!
Apoorv

[1]: http://pointfree.io/ <http://pointfree.io/>

> On Jun 10, 2020, at 10:00, Bob Ippolito <bob at redivi.com> wrote:
> 
> The better question is why would you want to? If you could even manage, the result would be practically incomprehensible. 
> 
> On Wed, Jun 10, 2020 at 07:49 Alexander Chen <alexander at chenjia.nl <mailto:alexander at chenjia.nl>> wrote:
> hi,
> 
> --any function foldr
> myAny'' :: (a-> Bool) -> [a] -> Bool
> myAny'' f = foldr (\a b -> f a || b) False
> 
> this is the foldr notions. How would i make this point free?
> 
> best,
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org <mailto:Beginners at haskell.org>
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners <http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20200610/806d3461/attachment.html>


More information about the Beginners mailing list