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

Added a hlint file #17

Merged
merged 3 commits into from
Jan 27, 2020
Merged

Added a hlint file #17

merged 3 commits into from
Jan 27, 2020

Conversation

aleator
Copy link
Contributor

@aleator aleator commented Nov 30, 2019

Added a hlint file for finding places where flow can be used.

It is currently biased to use left-to-right operators

Added a hlint file to point out places where flow can be used.

It is currently biased towards left-to-right writing direction
Copy link
Owner

@tfausak tfausak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great!

I've never used a custom HLint file from another package/project before. How would a user consume this file?

hlint-flow.yaml Outdated
Comment on lines 22 to 25
- hint:
lhs: 'f <| x'
note: 'Use `|>` for natural reading direction'
rhs: 'x |> f'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I typically use <| for passing a big do block to a function. Does this hint fire for code like this?

liftIO <| do
  now <- getCurrentTime
  print now

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been bothering me also as I don't know how to do it. Perhaps this hint should be disabled?

@aleator
Copy link
Contributor Author

aleator commented Jan 13, 2020

You can run this by first installing hlint (stack install works well) and then doing hlint -h hlint-flow.yaml <file>. Would you like me to add few variations to the readme file?

I was impressed about the relude hlint file which was actually super helpful in learning relude and I think flow could be a similar case.

@tfausak
Copy link
Owner

tfausak commented Jan 13, 2020

Something in the README would be nice. That's what Relude does.

We could probably avoid all the directional hints. Maybe keep them in the file but comment them out?

Added instructions and removed the hints that
make bad suggestions on `f <| do ...`.
@aleator
Copy link
Contributor Author

aleator commented Jan 27, 2020

I removed the directional hints for <| and < !. I think the <. can still have them. Atleast, nothing where it would conflict with convention immediatedly popped to my mind.

Copy link
Owner

@tfausak tfausak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@tfausak tfausak merged commit 94a8908 into tfausak:master Jan 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants