Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong error format for Type.Infer.inferHandler: using a bare operation is deprecated #508

Open
anfelor opened this issue Apr 24, 2024 · 0 comments
Labels

Comments

@anfelor
Copy link
Collaborator

anfelor commented Apr 24, 2024

Consider the following state effect and handler:

effect state<a>
  fun get() : a
  fun put(x : a) : unit

fun state(s : a, f : () -> <state<a>,div|e> b) : <div|e> b
  var st := s
  with handler
    get() { st } // notice the missing 'fun' keyword
    fun put(s') { st := s }
  f()

Since we forgot to write fun in front of get, we get an error message:

Type.Infer.inferHandler: using a bare operation is deprecated.
  hint: start with 'val', 'fun', 'brk', or 'ctl' instead.
CallStack (from HasCallStack):
  error, called at src/Common/Failure.hs:46:12 in koka-3.1.1-GrUKw6cowJ9E7PPCKFMvzQ:Common.Failure
  raise, called at src/Common/Failure.hs:32:5 in koka-3.1.1-GrUKw6cowJ9E7PPCKFMvzQ:Common.Failure
  failure, called at src/Type/Infer.hs:1105:43 in koka-3.1.1-GrUKw6cowJ9E7PPCKFMvzQ:Type.Infer

The error message itself is good and tells us how to fix the problem. However, this error message comes from a call to error and does not fit in nicely with the rest of Koka's error reporting. In particular, there is no syntax highlighting in VSCode.

@TimWhiting TimWhiting added the bug label May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants