10 years ago, I thought "programming is too hard, I'll make tools to make it easier"
5 years ago, I thought "I'll make a new language to make it easier"
now I'm working on tools to make "making new languages" easier 😂
Here's what lenses look like in a "guess my number" game. This compiles to linear immutable code, where state (in this case) is threaded into and out of every function that needs it.
To make linear-flow/lenses easier to understand, I've developed an intermediate representation that compiles out the lenses, leaving (relatively) straightforward linear code.
I think the only two things that need explaining are:
- swap(pat,val) returns the current value of pat