-
Notifications
You must be signed in to change notification settings - Fork 195
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
pragma annotations and ghci #372
Comments
Do you have OverloadedStrings turned on? Does putting a type annotation :: String in the annotation fix it? |
Hi Neil,
On 09/08/2017 00:02, Neil Mitchell wrote:
Do you have OverloadedStrings turned on? Does putting a type annotation
:: String in the annotation fix it?
Yes, I have it OverloadedStrings automatically turned on in my
`ghci.conf` file.
and yes, adding the type annotation fixes the ghci error. The parens
are mandatory, though:
```
{-# ANN someFunc ("HLint: ignore Use fmap" :: String) #-}
```
This workaround solves the issue for me now. Thanks!
Do you think that this a bug, or instead that this is a limitation that
should be mentioned somewhere in the README?
Thanks again, for your responsive feedback and for this great tool!
Damien
|
I think it's an inevitable consequence of how GHC works. Worth noting in the README though. |
#372, add a FAQ entry in the README
Am I right in thinking annotations are actually Haskell expressions? Maybe you could introduce an annotation type which would help the type system? I could imagine something like: {-# ANN module (Ignore "Use fmap") #-} |
@ocharles - they are indeed Haskell expressions. But if I add a new constructor it has to be in a library and users have to add a compile time dependency on hlint, which would be a lot sadder than a type annotation. |
Ah right, that's quite a gotcha. Thanks for clarifying. |
This is not strictly speaking a bug report.
Here is my question: is it possible to use pragma annotations in code that is read by ghci?
My problem: it looks like I miss something so that ghci correctly reads hlint pragma annotations, assuming this is possible. Here is a stupid but minimal example showing the problem:
This code compiles correctly with
ghc
, and the annotation is correctly processed by the command-line toolhlint
, but not byghci
.The text was updated successfully, but these errors were encountered: