Fork me on GitHub

@noprompt this isn't necessarily in the scope of meander but saw some of your comments on specter but curious your thoughts on how you'd express something like creating lenses in clojure


It depends on what you mean by creating. I’m not sure what comments you saw in particular but I’m sure, whatever they are, my sentiment is probably the same regarding them — negative. Even in a statically typed setting where you can avoid the sort of bugs that come up in Clojure, they’re unappealing to me. Personally, I think the cognitive expense is too high. You have to learn how they work and then learn how they are used in practice.


tend to agree hence conflicted/searching for a better answer. the only other alternative i've found (and my current approach) is a boilerplate heavy conversion layer


for clarity: core problem is going from "unknown shape" => "known shape" => known shape modifications => "unknown shape"


"known shape" => "known shape modifications: where meander shines projecting the data modifications back out to the unknown shape => challenge


one thing i'm gonna try is just to see if in practice, i can switch the left/write clauses in meander and see if that automagically gives me the f^-1 projection lol, well that failed quickly. c'est la vie, battle to fight for another day


context: my shallow mental model of specter == lenses/cursors


problem space: UI databinding - some bound data => change shape to match expected shape => apply widget_render() function


the challenge lying in making it bidirectional, specifically in the inverse, and in turn making it composable


ex: a listview widget Change src shape: [{:name "foo" :addr "123 bar"} {:name "baz" :addr "456 baz"}] => [{:header "foo" :title "123 bar"} {:header "baz" :title "456baz"}]


but then being able to reflect this change: [{:header "new foo" :title "123 bar"} {:header "baz" :title "new address"}] => [{:name "new foo" :addr "123 bar"} {:name "baz" :addr "new address"}]


note: i think this feels like a different enough problem domain that's orthogonal to meander. also concede to the fp folks that lenses do address this but i still find them "high cognitive load" (debugging, groking code weeks later, etc)


mostly curious if others have traversed this problem space before experimenting myself (current thought is using macros and m/rewrite to create that inverse mapping automatically from meander)