Earlier quoted context omitted.
The thing is, it takes a bit of experience to appreciate why HKT are important, and typically you can only get this experience using Haskell. There’s a couple of ways to think about it: it gives you a way to talk about List rather than List of T, it enables you to write partial types like partially-applied functions, or it makes it possible to define Monads. But as I say, none of these things will sound immediately u…
I think there is a certain kind of programmer who enjoys the aesthetics of higher-kinded types, and after having made the investment to truly grok them, wants these HKTs to also be useful in practice. I don’t think the benefit ever materializes and highly abstract code is just indulgence. Much like the people who endlessly tinker with their IDE/emacs/desktop environment/shell in the name of productivity.
Free-types: Higher kinded types in TypeScript
31–40 of 51 posts
Re: Free-types: Higher kinded types in TypeScript
#32Earlier quoted context omitted.
The thing is, it takes a bit of experience to appreciate why HKT are important, and typically you can only get this experience using Haskell. There’s a couple of ways to think about it: it gives you a way to talk about List rather than List of T, it enables you to write partial types like partially-applied functions, or it makes it possible to define Monads. But as I say, none of these things will sound immediately u…
I think there is a certain kind of programmer who enjoys the aesthetics of higher-kinded types, and after having made the investment to truly grok them, wants these HKTs to also be useful in practice. I don’t think the benefit ever materializes and highly abstract code is just indulgence. Much like the people who endlessly tinker with their IDE/emacs/desktop environment/shell in the name of productivity.
People believed (and some still do believe) the same thing about generics.
Re: Free-types: Higher kinded types in TypeScript
#33Earlier quoted context omitted.
> No. Typescript cannot access runtime values (I assume you mean types that depend on runtime values). That's not the meaning of dependent types, and dependent type checkers don't require runtime information.
"a dependent function may depend on the value (not just type) of one of its arguments" from wikipedia https://en.wikipedia.org/wiki/Dependent_type The value does not exist during compilation. AFAIKT dependent type are used mostly during executable proof checkers to verify claims on the value-dependent types. So maybe using the term runtime is a bit to specific, but you do not have values (except literals) during type…
type Z = []["length"]
type One = [0]["length"]
type Two = [0,0]["length"]Re: Free-types: Higher kinded types in TypeScript
#34I'm reasonably proficient in Typescript although I wouldn't call myself an expert in type systems. But I'm not a beginner either. However, I read though the readme and I have no idea what the usefulness of this is. Can anyone explain, in simple terms, some practical use cases for this?
The thing is, it takes a bit of experience to appreciate why HKT are important, and typically you can only get this experience using Haskell. There’s a couple of ways to think about it: it gives you a way to talk about List rather than List of T, it enables you to write partial types like partially-applied functions, or it makes it possible to define Monads. But as I say, none of these things will sound immediately u…
They're fairly common in Scala too, and I believe in OCaml through modules.
Re: Free-types: Higher kinded types in TypeScript
#35Looking forward to a proper monad lib in Typescript! However, I can only assume that molding/abusing types like this might have a big - if not huge - impact on compilation times... I've created a template-like generic type that allows you compose multiple kinds and replace any property of an object with a function returning the same type as the property, and vscode has such a hard time inferring types that intellisen…
I'm using fp-ts https://gcanti.github.io/fp-ts/
Re: Free-types: Higher kinded types in TypeScript
#36Earlier quoted context omitted.
> No. Typescript cannot access runtime values (I assume you mean types that depend on runtime values). That's not the meaning of dependent types, and dependent type checkers don't require runtime information.
"a dependent function may depend on the value (not just type) of one of its arguments" from wikipedia https://en.wikipedia.org/wiki/Dependent_type The value does not exist during compilation. AFAIKT dependent type are used mostly during executable proof checkers to verify claims on the value-dependent types. So maybe using the term runtime is a bit to specific, but you do not have values (except literals) during type…
Re: Free-types: Higher kinded types in TypeScript
#37Earlier quoted context omitted.
The thing is, it takes a bit of experience to appreciate why HKT are important, and typically you can only get this experience using Haskell. There’s a couple of ways to think about it: it gives you a way to talk about List rather than List of T, it enables you to write partial types like partially-applied functions, or it makes it possible to define Monads. But as I say, none of these things will sound immediately u…
> The thing is, it takes a bit of experience to appreciate why HKT are important, and typically you can only get this experience using Haskell. They're fairly common in Scala too, and I believe in OCaml through modules.
Re: Free-types: Higher kinded types in TypeScript
#38Why
A simple example I could recall from the other day is something like this: export type LinkedWorksheetsRecord = Record >; export type LinkedWorksheetsMap = Map >; What I would rather have written instead is however something like this: export type LinkedWorksheets = T >; ... const myMap: LinkedWorksheets = ...; This is however not possible, because `Map` is a type constructor which expects two more type arguments `K,…
Re: Free-types: Higher kinded types in TypeScript
#39Re: Free-types: Higher kinded types in TypeScript
#40Looking forward to a proper monad lib in Typescript! However, I can only assume that molding/abusing types like this might have a big - if not huge - impact on compilation times... I've created a template-like generic type that allows you compose multiple kinds and replace any property of an object with a function returning the same type as the property, and vscode has such a hard time inferring types that intellisen…
I'm using fp-ts https://gcanti.github.io/fp-ts/
I'm not associated with effect-ts at all.