Effect CommunityEC
Effect Community3y ago
17 replies
webvv

Understanding HKT in Effect-ts: Exploring the Purpose of the "else" Part and Thunk Types

Hello everyone. I'm trying to understand how HKT works in Effect-ts. I read through this article: https://dev.to/effect-ts/encoding-of-hkts-in-typescript-5c3. Pretty interesting. I have couple of questions:
- Looking at the Kind definition in the article, what is the purpose of else part of F extends { readonly type: unknown } ? ... : .... Can you please explain with some examples? The thunk types like () => A specially is confusing to me.
- Looking at the Kind definition in /src/HKT.ts it is a bit different than the article definition. First difference is the naming. Can you please explain what is the idea behind the namings In, Out2, Out1 and Target? and the definition as some differences as well (like type does not exist on HKT interface unlike the article. and there is Target.
Was this page helpful?