judah/haskeline

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

yokodake opened this issue · 4 comments

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.

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.

c_WaitForSingleObject was introduced in b2b86de (@RyanGlScott 's Christmas present to haskeline of 2015) which has been released in 0.7.2.3 (see 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/

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