Stream: beginners

Topic: Type annotated main ending in `!` does not compile


view this post on Zulip Ian McLerran (Sep 25 2024 at 18:14):

Not sure if this has already been addressed in another thread, but there is currently a bug which causes a roc program who's main function is type annotated, and ends in a ! operator to fail to compile:

So this does not compile:

main : Task {} _
main = Stdout.line! "Hello, world!"

But both of these do:

main : Task {} _
main = Stdout.line "Hello, world!"
main = Stdout.line! "Hello, world!"

view this post on Zulip Ian McLerran (Sep 25 2024 at 18:15):

The error message produced is the following:

Error message:

view this post on Zulip Kilian Vounckx (Sep 25 2024 at 20:37):

I think there was already a thread somewhere about it. Not sure though. If I recall correctly, it is not only with main, but any function with a single statement which ends in a '!'.

view this post on Zulip Luke Boswell (Sep 25 2024 at 21:04):

I think I know where the issue is roughly... though got distracted and havent looked at it since I made the comment.

https://github.com/roc-lang/roc/issues/7103


Last updated: Jul 06 2025 at 12:14 UTC