Skip to content
Discussion options

You must be logged in to vote

Yes, any effect type <x> would be a subtype of <x,a,b,c...>.
However, with polymorphic effect type variables this changes a bit.

Let's use something other than io to make it a little more explicit. Let's just do exception.

So this is the program you are trying to write, and it is causing errors:

fun use-int(block: (int) -> e a): <exn|e> a
  throw("10") 
  block(55)

fun main()
  use-int fn (i)
    println("got: " ++ i.show)

The problem here is that block can throw exception. (After all the variable e can unify with anything).
Since it can throw an exception, which handler should handle it? The same one that catches errors thrown by use-int? Or a different one? In other words, is the hand…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@TimWhiting
Comment options

@timbertson
Comment options

Answer selected by timbertson
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants