Post: Practical Profunctor Lenses & Optics in PureScript

lens
blog-posts
#1

Optics and lenses are, in my opinion, one of PureScript’s killer features.

I remember @monoidmusician teaching me how to use them to deal with a horrible set of deeply-nested maps I’d set up and having one of those functional programming aha! moments. Since then I’ve found them used pervasively through production code at companies I’ve worked for, but not very much written about how to use them to solve practical problems in PureScript.

I’ve published a new article which details exactly that, walking through the most common types, functions, and constructors from the profunctor-lenses library.

If you haven’t used optics before, or if you’re still not as comfortable with them as you’d like, this article will help you become more adept using them to solve real problems in your code.

thomashoneyman.com/articles/practical-profunctor-lenses-optics/

I’d love to hear what you think!

If you learned something new, please consider sharing this with your colleagues, Twitter followers, or other folks who might find it interesting and useful, too.


Thank you to @colinwahl, @JordanMartinez, @goodacre.liam, @monoidmusician, and Vance Palacio for reviewing the draft.

18 Likes
#2

Really nice article, thanks!

1 Like
#3

@thomashoneyman I finally managed to go through this, and it’s such a lovely introduction to lenses and prisms and now I’m recommending it to friends and family :smile:

So thanks a lot for writing your posts (I also loved the React one) as you do, it’s easy to see you put great care in making things clear and understandable and with a nice learning curve :slight_smile:

2 Likes
#4

Thank you! I’m glad to hear that, and I’m looking forward to demystifying more things that have stumped me in the past.