This patch adds support for polymorphic operations.
For this we have to annotate the cases in the handler with polymorphic operation types.
Example
sig h : (Comp(b, {A:forall a. (a) => a, Fail:forall a. a|c})) {A{_}, Fail{_}|c}~> Maybe(b)
fun h (m) {
handle(m()) {
case <A(x) => k> : (forall a. (a) => a) -> k (x)
case <Fail> : (forall a. () => a) -> Nothing
case x -> Just(x)
}
}
sig f : () {A:forall a. (a) => a|_}-> Int
fun f () {
if (do A(true)) do A(1) else
do A(42)
}
This is done by having actual operation patterns and using the type annotation system associated with it.
Clean-up of #1158.
This patch adds support for polymorphic operations.
For this we have to annotate the cases in the handler with polymorphic operation types.
Example
This is done by having actual operation patterns and using the type annotation system associated with it.