-
In my evolving bbtree exploration, I'm having trouble eliminating an inferred
and as before:
but note that I renamed Koka is complaining that
Is there a way to work around this? I don't want all my library functions that call If you want more context the code is in this github repo |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @dcurrie. Well, Koka is very predictable with inferring In the above case though, I think it is easiest to make the match more apparent to Koka, especially since
this is total now. Maybe rename |
Beta Was this translation helpful? Give feedback.
Hi @dcurrie. Well, Koka is very predictable with inferring
exn
anddiv
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 arepure
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
andextract-max
are "double" matching onNode
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: