Generalizing 'jq' and Traversal Systems using optics and standard monads
1–10 of 102 posts
Re: Generalizing 'jq' and Traversal Systems using optics and standard monads
#2So much work goes in most languages into processing nested data structures, especially in this day and age of heterogeneous APIs, and a lot of it is actually not that difficult to generalize conceptually into most languages. A few weeks ago I wrote a PoC in Python and it was remarkably easy to make a lens for traversing data structures.
Declarative optics and updates would make writing business logic a lot easier on so many domains.
Re: Generalizing 'jq' and Traversal Systems using optics and standard monads
#3Re: Generalizing 'jq' and Traversal Systems using optics and standard monads
#4Optics, as the OP calls it, is definitely an underestimated problem of modern computing. So much work goes in most languages into processing nested data structures, especially in this day and age of heterogeneous APIs, and a lot of it is actually not that difficult to generalize conceptually into most languages. A few weeks ago I wrote a PoC in Python and it was remarkably easy to make a lens for traversing data stru…
Re: Generalizing 'jq' and Traversal Systems using optics and standard monads
#5"Optics" and "lenses" seem like such bad names just to be able to make a "view data through a lens" pun.
Re: Generalizing 'jq' and Traversal Systems using optics and standard monads
#6"Optics" and "lenses" seem like such bad names just to be able to make a "view data through a lens" pun.
- lenses “focus” on elements of a product type
- prisms “split” a sum type so that optics can work over selected branches
...feels nice when you’ve been working with it for awhile.
Re: Generalizing 'jq' and Traversal Systems using optics and standard monads
#7[1] https://www.inkandswitch.com/cambria.html
[2] https://news.ycombinator.com/item?id=24699615
[3] https://bartoszmilewski.com/2014/10/28/category-theory-for-p...
Re: Generalizing 'jq' and Traversal Systems using optics and standard monads
#8Optics, as the OP calls it, is definitely an underestimated problem of modern computing. So much work goes in most languages into processing nested data structures, especially in this day and age of heterogeneous APIs, and a lot of it is actually not that difficult to generalize conceptually into most languages. A few weeks ago I wrote a PoC in Python and it was remarkably easy to make a lens for traversing data stru…
I wonder how these "optics" compare to .NET's Language Integrated Queries (LINQ) (see https://en.wikipedia.org/wiki/Language_Integrated_Query )
Re: Generalizing 'jq' and Traversal Systems using optics and standard monads
#9 for staff in company.staff:
for pet in staff.pets:
if pet.type == 'cat':
print(pet.name + " belongs to " + staff.name)
I don't understand why functional languages are used at all.Re: Generalizing 'jq' and Traversal Systems using optics and standard monads
#10Why do you need all this theory when you can use simple imperative languages? for staff in company.staff: for pet in staff.pets: if pet.type == 'cat': print(pet.name + " belongs to " + staff.name) I don't understand why functional languages are used at all.
`.company.staff | .pets | flatten | filter .type == "cat" | log(...)`