News for hackers. Stuff that matters.
Re:What the heck is a homomorphic mapped type? by Klathmon on Sunday January 07, 2024 @10:20AM (#38901904)
My biggest pet peeve with typescript is how it never explains most of this stuff officially.

The docs try to dumb things down but in my opinion it just makes it harder to understand these more complex pieces. Like the article mentions, the typescript handbook no longer even mentions the term homomorphic!

After working with typescript heavily for a few years I kind of had a bit of an intuition for some of the details here, but the article helped finally explain it in a way that I can truly understand.

Re:What the heck is a homomorphic mapped type? by epolanski on Sunday January 07, 2024 @12:26PM (#38903101)
> My biggest pet peeve with typescript is how it never explains most of this stuff officially.

From my anecdotical experience, 99 % of people cannot even define a mapped type or other core TypeScript concepts.

Re:What the heck is a homomorphic mapped type? by resoluteteeth on Sunday January 07, 2024 @01:59PM (#38904063)
I could be wrong, but I think it's maybe because the creators of typescript aren't that interested in actively encouraging people to use this kind of stuff as an end to itself?

Typescript's type system is extremely advanced, but it mostly only has such an advanced type system because that's the only way to support patterns that people are already using in javascript.

So for example, typescript has stuff like row polymorphism, because you may need to be able to add and remove properties to javascript objects, and row polymorphism is the only way to make that type safe, but it's not a language like purescript where the whole language is oriented around using row polymorphism for the effect system and the documentation is going to actively encourage you to use row polymorphism if you weren't already as a new pattern that you should use for your code.

The official documentation is simply going to tell you, if you try to look up how to add/remove properties in a type safe way, how you can do that within the type system.

Unfortunately I think this leads to a situation where only people who are already familiar with some of these ideas from other languages are really interested in experimenting with it, which may be a bit of a missed opportunity.

Re:What the heck is a homomorphic mapped type? by wavemode on Sunday January 07, 2024 @05:10PM (#38905679)
Even PureScript ultimately ditched the whole row-polymorphic Eff thing and now uses one big IO monad (called "Effect").

The juice ended up not being worth the squeeze, so to speak.

Re:What the heck is a homomorphic mapped type? by resoluteteeth on Sunday January 07, 2024 @06:32PM (#38906348)
Oh I didn't even know that, huh. I'm still hoping people eventually get the effect system approach to be sufficiently ergonomic for it to make it's way into more languages.
Re:What the heck is a homomorphic mapped type? by miiiiiike on Sunday January 07, 2024 @05:30PM (#38905860)
> My biggest pet peeve with typescript is how it never explains most of this stuff officially.

All of it is in the documentation.. And saying that, I ordered two books on Typescript this week exclusively to brush on on stuff like this. So, yep.