koka-lang / koka

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

Koka tutorial has non-divergent effect type signature for `looptest` #6

Closed rauchg closed 7 years ago

rauchg commented 7 years ago

image

When I hover the looptest identifier, I don't see div, which is to be expected from the usage of while? I also don't see exn, which should come from error.

daanx commented 7 years ago

Hi :-) Thanks for trying Koka! The pure effect is an alias for <exn,div> and includes both exceptions and possible divergence. The total effect is used for mathematically total functions. The terminology is chosen because it corresponds to Haskell's notion of purity where "pure" functions (and values!) can actually diverge or raise exceptions.

daanx commented 7 years ago

btw. You can see the definition of pure in the std/core library.

rauchg commented 7 years ago

@daanx that makes it super clear. Thank you