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 declaration to test file to supress warnings #305

Closed
wants to merge 1 commit into from
Closed

Add type declaration to test file to supress warnings #305

wants to merge 1 commit into from

Conversation

danny-andrews
Copy link

On the current version of purescript, omitting a type declaration for the
top-level declaration of main emits an MissingTypeDeclaration error. This
prevents that.

On the current version of purescript, omitting a type declaration for the
top-level declaration of main emits an MissingTypeDeclaration error. This
prevents that.
@hdgarrood
Copy link
Collaborator

From about two paragraphs before this:

The compiler will display several warnings about missing type declarations. In general it is considered good practice to provide explicit type signatures. In this guide, they are left out for brevity. In the absence of type signatures, the PureScript compiler infers types automatically but will remind us to consider adding them.

@hdgarrood
Copy link
Collaborator

To clarify my position, I'm open to adding type signatures so that these warnings aren't emitted, but also I'm tempted to leave it as it is. In any case, we should ensure that the guide is internally consistent, both in that we are using the same style throughout and in that it doesn't contradict itself by saying it won't use type signatures and then using them anyway.

@danny-andrews
Copy link
Author

I gotcha. As a complete beginner, seeing a warning in the console when I run the tests makes me feel like I did something wrong, but if I had seen the note, I would have been able to disregard it. So feel free to close this.

@hdgarrood
Copy link
Collaborator

In practice almost all code does include type signatures, and I agree that having the expected path through this guide emit warnings is not ideal, so I think adding them in this guide is probably not a bad option. I think they might have been omitted originally because the old Eff type (which had two type arguments: an effect row, and the type of the result) could have been a bit intimidating, but now we just have Effect instead I think it's less of a concern. I would definitely be happy to consider adding type signatures throughout this guide (and removing that note that says they are omitted).

@hdgarrood
Copy link
Collaborator

I'm going to close this for now as a bit more work would be necessary before this is mergeable, but we can continue discussion in #318.

@hdgarrood hdgarrood closed this May 20, 2020
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

Successfully merging this pull request may close these issues.

2 participants