haskell / haskeline

A Haskell library for line input in command-line programs.
https://hackage.haskell.org/package/haskeline
BSD 3-Clause "New" or "Revised" License
223 stars 75 forks source link

Ambiguous occurrence `c_WaitForSingleObject' for win32 > 2.10 && <= 2.12 #159

Open yokodake opened 3 years ago

yokodake commented 3 years ago

When building haskeline-0.8.1.2 (as a dependency) it fails with the following error:

dist\build\System\Console\Haskeline\Backend\Win32.hs:69:12: error:
    Ambiguous occurrence `c_WaitForSingleObject'
    It could refer to
       either `System.Win32.c_WaitForSingleObject',
              imported from `System.Win32' at System\Console\Haskeline\Backend\Win32.hsc:14:1-80
              (and originally defined in `System.Win32.Event')
           or `System.Console.Haskeline.Backend.Win32.c_WaitForSingleObject',
              defined at dist\build\System\Console\Haskeline\Backend\Win32.hs:51:1
   |
69 |     ret <- c_WaitForSingleObject h waitTime
   |            ^^^^^^^^^^^^^^^^^^^^^
cabal: Failed to build haskeline-0.8.1.2 (which is required by

Though I noticed this has already been fixed in win32-2.12.

Since I don't have much experience with maintaining libraries, I'm not sure if simply updating the win32 version bounds to >= 2.0 && < 2.10.1 && >= 2.12 is enough. I would have made a PR otherwise.

andreasabel commented 3 years ago

Me too. See https://github.com/agda/agda/runs/4200138734?check_suite_focus=true#step:11:2537 In my case it is haskeline-0.8.2: https://github.com/agda/agda/runs/4200138734?check_suite_focus=true#step:11:2749

andreasabel commented 3 years ago

Here are some build failures with GHC 9.2:

$ cabal build --constraint='Win32 < 2.12' --constraint='time<1.10'
Resolving dependencies...
Build profile: -w ghc-9.2.1 -O1
In order, the following will be built (use -v for more details):
 - process-1.6.13.2 (lib:process) (requires build)
 - haskeline-0.8.2 (lib) (first run)
 - haskeline-0.8.2 (exe:haskeline-examples-Test) (first run)
(ERROR as in OP)

... My experiments confirm the ones of @yokodake. Build fails with Win32-2.10/11.

andreasabel commented 3 years ago

c_WaitForSingleObject was introduced in b2b86de908e2478f2c24cf67a31ca84f1e342352 (@RyanGlScott 's Christmas present to haskeline of 2015) which has been released in 0.7.2.3 (see https://github.com/judah/haskeline/compare/0.7.2.2...0.7.2.3). Thus, I speculate that all versions >= 0.7.2.3 do not work with Win32 2.10/11. I will make the respective revisions on hackage. E.g.: https://hackage.haskell.org/package/haskeline-0.8.2/revisions/

andreasabel commented 1 year ago

@bgamari: I have fixed this in a PR that has been sitting around for over a year here now, please consider merging.