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

rename Close to avoid name ambiguity, fixing Windows build #20

Merged
merged 2 commits into from
Aug 30, 2022

Conversation

robx
Copy link
Contributor

@robx robx commented Aug 30, 2022

Somehow, we import GHC.Event.Windows.ConsoleEvent.Close on Windows
via Hasql.Pool.Prelude, which conflicts with Close.

  • might be nicer to avoid that import, but I couldn't figure out where it even comes from precisely (and I wouldn't want to conditionally hide an import based on CPP...)
  • should Windows be added to CI to verify this / prevent it in the future?

See this PostgREST CI failure: https://pipelines.actions.githubusercontent.com/serviceHosts/996fe3a3-010d-4e7c-a003-8e967bc4327c/_apis/pipelines/1/runs/2550/signedlogcontent/2?urlExpires=2022-08-30T06%3A30%3A28.3317426Z&urlSigningMethod=HMACV1&urlSignature=hCE13v%2Fp7jkakftXs%2FRp%2FY1EkmZVfgiucJpcj1kcobA%3D

2022-08-30T00:12:23.7448486Z �[0mhasql-pool                   > �[;1mlibrary\Hasql\Pool.hs:82:31: �[;1m�[31merror:�[0m�[0m�[;1m�[0m�[0m�[;1m�[0m
2022-08-30T00:12:23.7613309Z �[0mhasql-pool                   >     Ambiguous occurrence `Close'�[0m
2022-08-30T00:12:23.7625695Z �[0mhasql-pool                   >     It could refer to�[0m
2022-08-30T00:12:23.7647920Z �[0mhasql-pool                   >        either `Hasql.Pool.Prelude.Close',�[0m
2022-08-30T00:12:23.7650835Z �[0mhasql-pool                   >               imported from `Hasql.Pool.Prelude' at library\Hasql\Pool.hs:16:1-25�[0m
2022-08-30T00:12:23.7653713Z �[0mhasql-pool                   >               (and originally defined in `GHC.Event.Windows.ConsoleEvent')�[0m
2022-08-30T00:12:23.7655989Z �[0mhasql-pool                   >            or `Hasql.Pool.Close', defined at library\Hasql\Pool.hs:20:31�[0m�[0m�[0m
2022-08-30T00:12:23.7660646Z �[0mhasql-pool                   > �[;1m�[34m   |�[0m�[0m�[0m
2022-08-30T00:12:23.7674845Z �[0mhasql-pool                   > �[;1m�[34m82 |�[0m�[0m     writeTVar prevReuseToggle �[;1m�[31mClose�[0m�[0m�[0m
2022-08-30T00:12:23.7675918Z �[0mhasql-pool                   > �[;1m�[34m   |�[0m�[0m�[;1m�[31m                               ^^^^^�[0m�[0m

@nikita-volkov
Copy link
Owner

nikita-volkov commented Aug 30, 2022

should Windows be added to CI to verify this / prevent it in the future?

Sure! Let's do that.

Regarding the constructor conflict, I suggest to do one of the following:

  1. Hide Close on the import of Hasql.Pool.Prelude
  2. Rename constructors according to a convention of appending the type name to each constructor name. Notice that the other sum types in this package do follow that convention. See the UsageError type.
  3. Simply use Boolean.

I think, the second option is better, since it makes the codebase more consistent. Also the third option seems fine too.

Somehow, we import GHC.Event.Windows.ConsoleEvent.Close on Windows
via Hasql.Pool.Prelude, which conflicts with Close.
@robx robx force-pushed the fix-windows branch 2 times, most recently from dc44f2e to 1c27058 Compare August 30, 2022 13:30
.github/workflows/haskell.yml Outdated Show resolved Hide resolved
@robx
Copy link
Contributor Author

robx commented Aug 30, 2022

I went with the Bool option now for simplicity (naming things is hard), and gave up on Windows CI for now, filed the failed attempt over at #21.

@nikita-volkov nikita-volkov merged commit e71aaa3 into nikita-volkov:master Aug 30, 2022
@robx robx deleted the fix-windows branch August 30, 2022 18:01
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.

None yet

2 participants