Skip to content

Compiler inferring exn effect that I believe is not true... how to eliminate? #121

Answered by daanx
dcurrie asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @dcurrie. Well, Koka is very predictable with inferring exn and div on purpose -- this is to make the type inference stable and predictable. But it comes at a price that it does not do cross-function analysis but just per-match. One thing we can do is change our attitude: in the most "pure" language out there, Haskell, all functions are pure which is <div,exn> in Koka :-) So, exn is not too bad ;-)

In the above case though, I think it is easiest to make the match more apparent to Koka, especially since extract-min and extract-max are "double" matching on Node each time and then match one level deeper in there. We can lift that out and pass the fields of the node directly as parameters:

f…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@dcurrie
Comment options

Answer selected by dcurrie
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