I've been working on a window manager lately, but this post isn't about that. Perhaps a later one will be.
In the course of this work, I stumbled across a sort of gap in what you can easily do with Haskell's record syntax:
Basically, getting an updated record where a function has been applied to a particular field involves naming the field and the record twice. The longer the names, the worse it gets. I solved this problem with some Template Haskell:
It gets even better when the record you are updating is the state of a State monad:
Since the record doesn't need to be named, the lambda is avoided.
Take a look at the code to see how it works.
0 comments:
Post a Comment