-
Notifications
You must be signed in to change notification settings - Fork 568
WildcardInferredType
warning when using wildcards in a visible type application
#4488
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
Comments
There's a related issue with type holes: module Main where
import Prelude
import Effect (Effect)
import Effect.Console (log)
f :: forall @a. a -> a
f = identity
x :: { x :: Int }
x = f @{ x :: ?Help } { x: 42 }
main = log "Done" produces:
How should this case be handled? |
Holes are an explicit request for information; I think that behavior's correct. |
But aren't type applications a user-supplied piece of information? AFAICT, wildcards are only allowed in VTAs as a means of skipping the next type variable because there's not an alternative syntax. |
Yes. Let me restate: a hole is the user asking the compiler for information. No program with a hole anywhere in the source should compile, because the hole doesn't say ‘I don't care’ like a wildcard does; it says ‘tell me what I should put here (instead of completing the compilation)’. |
I understand that. I'm asking, "Just because VTAs can be used to do that, should they?" 🤔 Perhaps my understanding of VTAs' purpose is too limited. I guess there's really no difference between these two mechanisms for instructing the compiler what the type with which to unify
They are different in that
If I'm arguing that VTAs should not allow type holes, then you could counter by asking, "Why can type annotations have them? If we want to be consistent, we should remove type holes from type annotations as well." Well... all that to say... It feels weird to me to allow them here, but I can't disagree with them being there anymore based on the previous paragraph. |
Description
Using wildcards in a visible type application produces a
WildcardInferredType
warning.To Reproduce
Compiler output:
Expected behavior
There should be no warning.
PureScript version
0.15.10
The text was updated successfully, but these errors were encountered: