Skip to content

Commit 2790f1c

Browse files
authored
Win32: Hide console primitives from Win32-2.9 (#145)
Win32 provides a few console primitives as of the 2.9 release, resulting in name shadowing warnings with our own local versions. Hide those from Win32 to avoid the warnings.
1 parent a305332 commit 2790f1c

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

System/Console/Haskeline/Backend/Win32.hsc

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
{-# LANGUAGE CPP #-}
2+
13
module System.Console.Haskeline.Backend.Win32(
24
win32Term,
35
win32TermStdin,
@@ -8,7 +10,11 @@ module System.Console.Haskeline.Backend.Win32(
810
import System.IO
911
import Foreign
1012
import Foreign.C
13+
#if MIN_VERSION_Win32(2,9,0)
14+
import System.Win32 hiding (multiByteToWideChar, setConsoleMode, getConsoleMode)
15+
#else
1116
import System.Win32 hiding (multiByteToWideChar)
17+
#endif
1218
import Graphics.Win32.Misc(getStdHandle, sTD_OUTPUT_HANDLE)
1319
import Data.List(intercalate)
1420
import Control.Concurrent.STM
@@ -185,9 +191,9 @@ instance Storable Coord where
185191
sizeOf _ = (#size COORD)
186192
alignment _ = (#alignment COORD)
187193
peek p = do
188-
x :: CShort <- (#peek COORD, X) p
189-
y :: CShort <- (#peek COORD, Y) p
190-
return Coord {coordX = fromEnum x, coordY = fromEnum y}
194+
cx :: CShort <- (#peek COORD, X) p
195+
cy :: CShort <- (#peek COORD, Y) p
196+
return Coord {coordX = fromEnum cx, coordY = fromEnum cy}
191197
poke p c = do
192198
(#poke COORD, X) p (toEnum (coordX c) :: CShort)
193199
(#poke COORD, Y) p (toEnum (coordY c) :: CShort)

0 commit comments

Comments
 (0)