Fork me on GitHub
#meander
<
2020-07-30
>
ikrimael22:07:19

@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

noprompt00:07:03

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.

ikrimael01:07:37

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

ikrimael01:07:23

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

ikrimael01:07:17

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

ikrimael01:07:23

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

ikrimael22:07:42

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

ikrimael22:07:59

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

ikrimael22:07:53

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

ikrimael22:07:43

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"}]

ikrimael22:07:44

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"}]

ikrimael22:07:24

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)

ikrimael23:07:57

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)