Skip to content

Commit d408cc9

Browse files
committed
Improve Show instance for windows
1 parent 55ca988 commit d408cc9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

System/OsString/Internal/Types.hs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ import Data.Semigroup
4040
#endif
4141
import GHC.Generics (Generic)
4242

43+
import System.OsPath.Encoding.Internal
4344
import qualified System.OsPath.Data.ByteString.Short as BS
45+
import qualified System.OsPath.Data.ByteString.Short.Word16 as BS16
4446
#if MIN_VERSION_template_haskell(2,16,0)
4547
import qualified Language.Haskell.TH.Syntax as TH
4648
#endif
@@ -58,7 +60,8 @@ newtype WindowsString = WindowsString { getWindowsString :: BS.ShortByteString }
5860
deriving (Eq, Ord, Semigroup, Monoid, Typeable, Generic, NFData)
5961

6062
instance Show WindowsString where
61-
show (WindowsString ws) = show ws
63+
-- cWcharsToChars is total
64+
show = show . cWcharsToChars . BS16.unpack . getWindowsString
6265

6366
-- | Just a short bidirectional synonym for 'WindowsString' constructor.
6467
pattern WS :: BS.ShortByteString -> WindowsString

0 commit comments

Comments
 (0)