blob: 6419da7544aa54d7d2d21705723ea8b6cb189e26 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
-- {-# LANGUAGE NoBangPatterns #-}
module T17162 where
charIsRepresentable :: TextEncoding -> Char -> IO Bool
charIsRepresentable !enc c =
withCString enc [c]
(\cstr -> do str <- peekCString enc cstr
case str of
[ch] | ch == c -> pure True
_ -> pure False)
`catch`
\(_ :: IOException) -> pure False
|