TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Free-types: Higher kinded types in TypeScript

65 pointsby DesertVarnishalmost 2 years ago

9 comments

esperentalmost 2 years ago
I&#x27;m reasonably proficient in Typescript although I wouldn&#x27;t call myself an expert in type systems. But I&#x27;m not a beginner either.<p>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?
评论 #36255096 未加载
评论 #36255026 未加载
评论 #36254771 未加载
stevefan1999almost 2 years ago
I wonder if there is any relationship between HKT and C#&#x2F;Rust generics, from my perspective I always see HKT as &quot;A type that accepts types that generates another type&quot; and generic as &quot;A functor that accepts types that generates another type&quot;. That makes me wonder if types and functors are exchangable.
评论 #36254561 未加载
评论 #36255047 未加载
评论 #36254443 未加载
epolanskialmost 2 years ago
I wonder how this differs from HKT&#x27;s implementation in fp-ts 2 and Effect-TS.<p><a href="https:&#x2F;&#x2F;gcanti.github.io&#x2F;fp-ts&#x2F;modules&#x2F;HKT.ts.html" rel="nofollow">https:&#x2F;&#x2F;gcanti.github.io&#x2F;fp-ts&#x2F;modules&#x2F;HKT.ts.html</a>
noobdev9000almost 2 years ago
Why
评论 #36254538 未加载
ToJansalmost 2 years ago
Looking forward to a proper monad lib in Typescript!<p>However, I can only assume that molding&#x2F;abusing types like this might have a big - if not huge - impact on compilation times...<p>I&#x27;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 intellisense has become unusable in this context.<p>Curious to see how this will turn out.
评论 #36254270 未加载
jdonaldsonalmost 2 years ago
Higher kinded types always remind me of regex. People think “I know, I’ll use HKT to solve this problem”. Now they have two problems.<p>These techniques can be way overkill for someone until they are dealing with an overwhelming amount of types to unify. It’ll seem like a terrible idea until that obstacle is encountered.
davedxalmost 2 years ago
I’d love to be able to do dependent types in TS. Does this make that possible?
评论 #36254315 未加载
评论 #36255142 未加载
评论 #36254440 未加载
classifiedalmost 2 years ago
I can&#x27;t make sense of the examples. What would I use this for?
xupybdalmost 2 years ago
Are these like type classes?
评论 #36256420 未加载