haskell / win32

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

Consolidate CodePage in System.Win32.NLS with the CodePage in base-4.15 #169

Closed RyanGlScott closed 3 years ago

RyanGlScott commented 3 years ago

Both Win32 and base-4.15 define identical (but distinct) type synonyms named CodePage. I propose that Win32 re-export the CodePage from base when possible.

Current Behavior

As of base-4.15, the GHC.IO.Encoding.CodePage module defines a type synonym named CodePage:

type CodePage = DWORD

As it turns out, the Win32 library also defines an identical (but distinct) type synonym named CodePage in System.Win32.NLS:

https://github.com/haskell/win32/blob/b297380a778b24a2afd98e091303294f7a35aa1c/System/Win32/NLS.hsc#L72

(Note that DWORD = UINT = Word32.) This creates problems for code that tries to use both System.Win32.NLS and GHC.IO.Encoding.CodePage together, as their two CodePage definitions will clash.

Steps to Reproduce (for bugs)

An example of a library that this actually affected in practice in code-page, which stopped building after base-4.15's release. See RyanGlScott/code-page#5. It's possible to work around the issue, but if Win32 simply re-exported CodePage from base, this bug would have never happened in the first place.

Your Environment

RyanGlScott commented 3 years ago

170 implements this idea.

Mistuke commented 3 years ago

Thanks for the issue and PR @RyanGlScott, do you need a release before the scheduled monthly one?

RyanGlScott commented 3 years ago

Thanks! And I'm not in a hurry to get this released to Hackage, so the current release schedule is fine.