haskell / win32

Haskell support for the Win32 API
http://hackage.haskell.org/package/Win32
Other
97 stars 63 forks source link

#221 Introduced unused-imports warnings which lead to failures in GHC #224

Closed BinderDavid closed 11 months ago

BinderDavid commented 12 months ago

I think #221 introduced some code which generates "unused-imports" warnings when compiled with GHC. This leads to the fact that the submodule within GHC cannot be updated, since -Werror is enabled. I observed this in the following pipeline: https://gitlab.haskell.org/ghc/ghc/-/jobs/1722073

===> Command failed with error code: 1
_build\stage1\libraries\Win32\build\System\Win32\WindowsString\Console.hs:67:1: error: [GHC-66111] [-Wunused-imports, Werror=unused-imports]
    The import of `Graphics.Win32.Misc' is redundant
      except perhaps to import instances from `Graphics.Win32.Misc'
    To import instances alone, use: import Graphics.Win32.Misc()
   |
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^
_build\stage1\libraries\Win32\build\System\Win32\WindowsString\Console.hs:68:1: error: [GHC-66111] [-Wunused-imports, Werror=unused-imports]
    The import of `Graphics.Win32.GDI.Types' is redundant
      except perhaps to import instances from `Graphics.Win32.GDI.Types'
    To import instances alone, use: import Graphics.Win32.GDI.Types()
   |
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_build\stage1\libraries\Win32\build\System\Win32\WindowsString\Console.hs:70:1: error: [GHC-66111] [-Wunused-imports, Werror=unused-imports]
    The import of `Foreign.C.Types' is redundant
      except perhaps to import instances from `Foreign.C.Types'
    To import instances alone, use: import Foreign.C.Types()
   |
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_build\stage1\libraries\Win32\build\System\Win32\WindowsString\Console.hs:71:1: error: [GHC-66111] [-Wunused-imports, Werror=unused-imports]
    The import of `Foreign.C.String' is redundant
      except perhaps to import instances from `Foreign.C.String'
    To import instances alone, use: import Foreign.C.String()
   |
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_build\stage1\libraries\Win32\build\System\Win32\WindowsString\Console.hs:72:1: error: [GHC-66111] [-Wunused-imports, Werror=unused-imports]
    The import of `Foreign.Ptr' is redundant
      except perhaps to import instances from `Foreign.Ptr'
    To import instances alone, use: import Foreign.Ptr()
   |
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_build\stage1\libraries\Win32\build\System\Win32\WindowsString\Console.hs:74:42: error: [GHC-38856] [-Wunused-imports, Werror=unused-imports]
    The import of `pokeArray'
    from module `Foreign.Marshal.Array' is redundant
   |
   |                                          ^^^^^^^^^
BinderDavid commented 12 months ago

Also #221 seems to have introduced a dependency on os-string which is not reflected in the cabal file. The appveyor CI reports this error for my #223

https://ci.appveyor.com/project/Mistuke/win32-5ec4k/builds/48620220/job/414ddky2omugv629

System\Win32\WindowsString\Types.hsc:41:1: error:
    Could not load module `System.OsString.Windows'
    It is a member of the hidden package `os-string-2.0.0'.
    Perhaps you need to add `os-string' to the build-depends in your .cabal file.
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
   |
41 | import System.OsString.Windows
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
System\Win32\WindowsString\Types.hsc:42:1: error:
    Could not load module `System.OsString.Internal.Types'
    It is a member of the hidden package `os-string-2.0.0'.
    Perhaps you need to add `os-string' to the build-depends in your .cabal file.
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
   |
42 | import System.OsString.Internal.Types
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
System\Win32\WindowsString\Types.hsc:43:1: error:
    Could not find module `System.OsPath.Data.ByteString.Short.Word16'
    Perhaps you meant
      System.OsString.Data.ByteString.Short.Word16 (needs flag -package-id os-string-2.0.0)
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
   |
43 | import System.OsPath.Data.ByteString.Short.Word16 (
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...
Error: cabal.exe: Failed to build Win32-2.13.4.0

I think this repo might also be missing branch protection for master? Ping @hasufell : You recently also worked on this repo.

hasufell commented 12 months ago

Also #221 seems to have introduced a dependency on os-string which is not reflected in the cabal file.

It does not. You simply have to depend on filepath < 1.5.

hasufell commented 12 months ago

That said, this library has to be updated to work with filepath >= 1.5.

See https://github.com/haskell/win32/issues/222

BinderDavid commented 12 months ago

It does not. You simply have to depend on filepath < 1.5.

Does this mean that in the meantime we have to add an upper bound on the filepath dependency? Because the failure occurs in the CI of this repo, not in some project of mine.

hasufell commented 12 months ago

It does not. You simply have to depend on filepath < 1.5.

Does this mean that in the meantime we have to add an upper bound on the filepath dependency? Because the failure occurs in the CI of this repo, not in some project of mine.

Yes

Mistuke commented 12 months ago

It does not. You simply have to depend on filepath < 1.5.

Does this mean that in the meantime we have to add an upper bound on the filepath dependency? Because the failure occurs in the CI of this repo, not in some project of mine.

I think we can ask a hackage trustee to modify the bounds so CI and projects don't break.

BinderDavid commented 12 months ago

I think we can ask a hackage trustee to modify the bounds so CI and projects don't break.

As a package maintainer you should have the rights to do metadata revisions yourself.