Skip to content

Commit 55ca988

Browse files
committed
Unwrap stuff in Show instance
1 parent cff0494 commit 55ca988

File tree

1 file changed

+25
-6
lines changed

1 file changed

+25
-6
lines changed

System/OsString/Internal/Types.hs

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ import qualified Language.Haskell.TH.Syntax as TH
5555

5656
-- | Commonly used windows string as UTF16 bytes.
5757
newtype WindowsString = WindowsString { getWindowsString :: BS.ShortByteString }
58-
deriving (Eq, Ord, Show, Semigroup, Monoid, Typeable, Generic, NFData)
58+
deriving (Eq, Ord, Semigroup, Monoid, Typeable, Generic, NFData)
59+
60+
instance Show WindowsString where
61+
show (WindowsString ws) = show ws
5962

6063
-- | Just a short bidirectional synonym for 'WindowsString' constructor.
6164
pattern WS :: BS.ShortByteString -> WindowsString
@@ -76,7 +79,10 @@ instance Lift WindowsString where
7679
-- | Commonly used Posix string as uninterpreted @char[]@
7780
-- array.
7881
newtype PosixString = PosixString { getPosixString :: BS.ShortByteString }
79-
deriving (Eq, Ord, Show, Semigroup, Monoid, Typeable, Generic, NFData)
82+
deriving (Eq, Ord, Semigroup, Monoid, Typeable, Generic, NFData)
83+
84+
instance Show PosixString where
85+
show (PosixString ps) = show ps
8086

8187
-- | Just a short bidirectional synonym for 'PosixString' constructor.
8288
pattern PS :: BS.ShortByteString -> PosixString
@@ -101,9 +107,16 @@ type PlatformString = PosixString
101107
#endif
102108

103109
newtype WindowsChar = WindowsChar { getWindowsChar :: Word16 }
104-
deriving (Eq, Ord, Show, Typeable, Generic, NFData)
110+
deriving (Eq, Ord, Typeable, Generic, NFData)
111+
112+
instance Show WindowsChar where
113+
show (WindowsChar wc) = show wc
114+
105115
newtype PosixChar = PosixChar { getPosixChar :: Word8 }
106-
deriving (Eq, Ord, Show, Typeable, Generic, NFData)
116+
deriving (Eq, Ord, Typeable, Generic, NFData)
117+
118+
instance Show PosixChar where
119+
show (PosixChar pc) = show pc
107120

108121
-- | Just a short bidirectional synonym for 'WindowsChar' constructor.
109122
pattern WW :: Word16 -> WindowsChar
@@ -134,7 +147,10 @@ type PlatformChar = PosixChar
134147
-- dealing with the internals isn't generally recommended, but supported
135148
-- in case you need to write platform specific code.
136149
newtype OsString = OsString { getOsString :: PlatformString }
137-
deriving (Show, Typeable, Generic, NFData)
150+
deriving (Typeable, Generic, NFData)
151+
152+
instance Show OsString where
153+
show (OsString os) = show os
138154

139155
-- | Byte equality of the internal representation.
140156
instance Eq OsString where
@@ -201,7 +217,10 @@ instance Lift OsString where
201217
-- On Windows, this is restricted to two-octet codepoints 'Word16',
202218
-- on POSIX one-octet ('Word8').
203219
newtype OsChar = OsChar { getOsChar :: PlatformChar }
204-
deriving (Show, Typeable, Generic, NFData)
220+
deriving (Typeable, Generic, NFData)
221+
222+
instance Show OsChar where
223+
show (OsChar pc) = show pc
205224

206225
-- | Byte equality of the internal representation.
207226
instance Eq OsChar where

0 commit comments

Comments
 (0)