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

Tool for formatting / inferring types #52

Closed
Pauan opened this issue Jul 14, 2017 · 1 comment
Closed

Tool for formatting / inferring types #52

Pauan opened this issue Jul 14, 2017 · 1 comment

Comments

@Pauan
Copy link

Pauan commented Jul 14, 2017

Some other languages (like go and Rust) have a tool which you can use to automatically format source code according to style guidelines.

In addition to formatting code, it would also be useful if the tool could infer Koka types and insert type annotations into the code.

As an example, let's say you had this Koka code:

fun foo(a) {
  a + 5
}

After running the format tool, it would replace the code with this:

fun foo(a: int): int {
  a + 5
}

If the inferred type is ambiguous, the tool can ask the programmer to choose from a list of possible types.

This gives the convenience of type inference (not needing to write out the types), but also gives the benefits of explicit type signatures (more robust, better documentation, faster compiling, and easier to read)

@anfelor
Copy link
Collaborator

anfelor commented Jun 17, 2021

This seems like a good proposal for the language server at #100 :)
Koka now has a --showtypesigs option that prints all top-level type signatures into the console

@anfelor anfelor closed this as completed Jun 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants