koka-lang / koka

Koka language compiler and interpreter
http://koka-lang.org
Other
3.26k stars 161 forks source link

Koka should infer div for rectypes #149

Open anfelor opened 3 years ago

anfelor commented 3 years ago

Koka v3.1.1 accepts the following program:

rec type spooky
  Spooky{ spook : spooky -> int }

fun spookMe(s : spooky) : total int
  match(s)
    Spooky(f) -> f(s)

fun loop() : total int // no div effect!
  spookMe(Spooky(spookMe))

fun main()
  println(loop())

Expected behaviour is that the div effect is inferred. Heuristically, this could happen anytime rec type is used.

anfelor commented 4 months ago

@daanx Since you were worried about there being no div in the absurd function, you might want to take a look at this :)