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

Add type annotation to main in projects generated by gleam new #4313

Open
drewolson opened this issue Mar 8, 2025 · 2 comments · May be fixed by #4326
Open

Add type annotation to main in projects generated by gleam new #4313

drewolson opened this issue Mar 8, 2025 · 2 comments · May be fixed by #4326
Labels
good first issue Good for newcomers help wanted Contributions encouraged priority:medium

Comments

@drewolson
Copy link

Currently, the gleam new command generates a project with a main function without a type annotation. It is idiomatic in gleam to include type annotations, and therefore I'd suggest we add an annotation to main of the type -> Nil.

@drewolson drewolson changed the title Add type annotation to main in project generated by gleam new Add type annotation to main in projects generated by gleam new Mar 8, 2025
@lpil
Copy link
Member

lpil commented Mar 10, 2025

I like that this will encourage people to annotate their functions, and maybe it'll persuade people not to try and return a result from their main function. It might be a slight annoyance if you do want to change the return type, but I'm not sure why you would want to return some other type.

I'm in favour of this, but I'm open to any other suggestions!

@lpil lpil added help wanted Contributions encouraged good first issue Good for newcomers priority:medium labels Mar 10, 2025
drewolson added a commit to drewolson/gleam that referenced this issue Mar 10, 2025
@drewolson
Copy link
Author

I've created a PR that resolves this issue. Once everyone agrees it is a reasonable approach, we can merge it.

drewolson added a commit to drewolson/gleam that referenced this issue Mar 10, 2025
drewolson added a commit to drewolson/gleam that referenced this issue Mar 11, 2025
drewolson added a commit to drewolson/gleam that referenced this issue Mar 11, 2025
drewolson added a commit to drewolson/gleam that referenced this issue Mar 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Contributions encouraged priority:medium
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants