Skip to content

Conversation

@dhil
Copy link
Member

@dhil dhil commented Jul 25, 2024

This patch makes it possible to annotate effectful operations at the term-level. Type annotations are crucial when operations are polymorphic. Prior to this patch, it was only possible to annotate polymorphic operations in signatures. As a consequence it was impossible to make the following kind of program type-check.

handle(do Throw) { case ans -> Just(ans) case <Throw> : (forall a. () => a) -> Nothing } 

The problem is that Links does not infer polymorphism (rightly so), so the inferred type of Throw will fail to check against the pattern type in the Throw-case. With this patch we can annotate the invocation to make the program type check.

handle(do (Throw : forall a. () => a)) { case ans -> Just(ans) case <Throw> : (forall a. () => a) -> Nothing } 
@dhil
Copy link
Member Author

dhil commented Jul 25, 2024

Closing and reopening to activate CI.

@dhil dhil closed this Jul 25, 2024
@dhil dhil reopened this Jul 25, 2024
This patch makes it possible to annotate effectful operations at the term-level. Type annotations are crucial when operations are polymorphic. Prior to this patch, it was only possible to annotate polymorphic operations in signatures. As a consequence it was impossible to make the following kind of program type-check. ```links handle(do Throw) { case ans -> Just(ans) case <Throw> : (forall a. () => a) -> Nothing } ``` The problem is that Links does not infer polymorphism (rightly so), so the inferred type of `Throw` will fail to check against the pattern type in the `Throw`-case. With this patch we can annotate the invocation to make the program type check. ```links handle(do (Throw : forall a. () => a)) { case ans -> Just(ans) case <Throw> : (forall a. () => a) -> Nothing } ```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant