avinder42 Profile Banner
Avinder Bahra Profile
Avinder Bahra

@avinder42

Followers
153
Following
884
Statuses
230

FP and House Music enthusiast. Lead developer on ZIO DynamoDB.

England, United Kingdom
Joined April 2016
Don't wanna be here? Send us removal request.
@avinder42
Avinder Bahra
5 days
@hmemcpy Congratulations!
0
0
0
@avinder42
Avinder Bahra
12 days
@Krever01 @kubukoz PS am so old my 1st desktop PC had 2MB ram
0
0
1
@avinder42
Avinder Bahra
12 days
Looking forward to using Schema 2 optics in ZIO DynamoDB
@jdegoes
John A De Goes
13 days
The optics in the new ZIO Schema I am working on are "reflective optics" (a term I just made up, but it fits). This means that, in addition to letting you do get- & set-like things (like legacy optics), you can ALSO access the reified structure of the underlying types. This lets you use the optics in DSLs, like SQL, DynamoDB, or Cassandra. e.g.: selectFrom("foo").where(Person.age > 20) Interestingly, however, reflective optics beat legacy optics at their own game in one important way: killer error messages. Optic composition invariably introduces optionality in "getting". With almost all legacy optics, you learn that SOME value had an unexpected constructor, but you don't get any information on the error, leaving you to puzzle over why some update operation didn't work. With reflective optics, it should be possible to support brilliant error messages, along the lines of: "In Order.items[*].billingAddress.country, expected field billingAddress to be Some but found None." Boom! You know exactly how your expectation differed from reality when doing some targeted operation on a deeply nested structure. As a bonus, reflective optics are also eminently usable as "keys" in maps, because the data they contain is sufficient for disambiguation. This means another place where they will shine is in applications involving data-generic metadata. Currently, if you have a deeply nested structure like Order, there's no good type-safe, expression-oriented way to attach metadata to particular parts of its substructure--not without modifying it and adding slots for the metadata. For example, you might want to attach documentation, validation rules, or format hints. With reflective optics, you can now attach arbitrary metadata to arbitrary parts of a substructure. For example: val validatedCodec = orderCodec.validate((items)(billingAddress)(country))(CountryCodes.contains(_)) This is going to open up new applications for optics, as well as greatly simplify some tasks that were possible before, but only at great cost to ergonomics (using fixed point data and recursion schemes, zippers, etc.). In short, reflective optics aren't your grandpa's optics--they're way better! 😅
0
0
7
@avinder42
Avinder Bahra
12 days
RT @jdegoes: The optics in the new ZIO Schema I am working on are "reflective optics" (a term I just made up, but it fits). This means tha…
0
6
0
@avinder42
Avinder Bahra
13 days
RT @jdegoes: Now, as funny as I find this, there's obviously something useful to learn from this kind of feedback: That a working develope…
0
2
0
@avinder42
Avinder Bahra
14 days
RT @etorreborre: I expand a bit on why we need a real programming language to configure our systems in my latest blog post:
0
4
0
@avinder42
Avinder Bahra
21 days
RT @graninas: 20 years ago, I started using a shit programming language. The tooling was shit too. I thought, it’s fine, because you can a…
0
1
0
@avinder42
Avinder Bahra
25 days
Can't wait for this!
@jdegoes
John A De Goes
25 days
My recent experiment is a success! The next version of ZIO Schema will be rad: - generic construction / deconstruction WITHOUT tuple boxing or primitive boxing (!!!) - real optics that can ALSO be used in DSLs - helps you derive type class instances without macros 😱
Tweet media one
0
0
4
@avinder42
Avinder Bahra
25 days
@jdegoes Can't wait for this!
0
0
3
@avinder42
Avinder Bahra
26 days
RT @graninas: Developers with a great short-term memory are the worst. They keep huge contexts in their heads and don't see the need to st…
0
4
0
@avinder42
Avinder Bahra
1 month
@alexelcu Well done! Strength in later life is very important
0
0
0
@avinder42
Avinder Bahra
1 month
@baldram Not had a chance to check this so far - I will try to give it a look soon
0
0
1
@avinder42
Avinder Bahra
1 month
Looks like I may have missed this half price sale!
0
0
1
@avinder42
Avinder Bahra
2 months
@kitlangton finally got some time to try this - worked flawlessly with zio-schema in a zio-dynamodb example - awesome work!
0
0
1
@avinder42
Avinder Bahra
2 months
@hmemcpy @zeddotdev Gonna sneak in a workout today in my home gym after roasting the vegetables
0
0
0
@avinder42
Avinder Bahra
2 months
@ghostdogpr zio-schema has reified optics but that is quite a specialised use case, maybe not what you are after
1
0
1
@avinder42
Avinder Bahra
2 months
@Krever01 We have used ZIO's ZSchedule as the cornerstone for such a solution
0
0
1
@avinder42
Avinder Bahra
2 months
@kitlangton Congrats!
0
0
1