-- -----------------------------------------------------------------------------
-- Win32 implementation
-#if (defined(HAVE_WCTYPE_H) && HAVE_ISWSPACE) || mingw32_TARGET_OS
+#if (defined(HAVE_WCTYPE_H) && HAVE_ISWSPACE && defined(HTYPE_WINT_T) || mingw32_TARGET_OS
-- Use the wide-char classification functions if available. Glibc
-- seems to implement these properly, even for chars > 0xffff, as long
-- friends won't work properly with characters > 0xffff. These
-- characters are represented as surrogate pairs in UTF-16.
-type WInt = (#type wint_t)
-type CInt = (#type int)
+type WInt = HTYPE_WINT_T
+type CInt = HTYPE_INT
isDigit c = iswdigit (fromIntegral (ord c)) /= 0
isAlpha c = iswalpha (fromIntegral (ord c)) /= 0
-- Case-changing operations
-toUpper c@(C## c##)
- | isAsciiLower c = C## (chr## (ord## c## -## 32##))
+toUpper c@(C# c#)
+ | isAsciiLower c = C# (chr# (ord# c# -# 32#))
| isAscii c = c
-- fall-through to the slower stuff.
| isLower c && c /= '\xDF' && c /= '\xFF'
= c
-toLower c@(C## c##)
- | isAsciiUpper c = C## (chr## (ord## c## +## 32##))
+toLower c@(C# c#)
+ | isAsciiUpper c = C# (chr# (ord# c# +# 32#))
| isAscii c = c
| isUpper c = unsafeChr (ord c `minusInt` ord 'A' `plusInt` ord 'a')
| otherwise = c