Skip to content

Commit a9702f0

Browse files
committed
Make OsString Lift instance compatible with GHC-8.10
1 parent 7d4a574 commit a9702f0

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

System/OsString/Internal/Types.hs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@ pattern WS { unWS } <- WindowsString unWS where
7777

7878

7979
instance Lift WindowsString where
80-
lift (WindowsString bs)
81-
= [| WindowsString (BS.pack $(lift $ BS.unpack bs)) :: WindowsString |]
80+
lift (WindowsString bs) = TH.AppE (TH.ConE 'WindowsString) <$> (lift bs)
8281
#if MIN_VERSION_template_haskell(2,17,0)
8382
liftTyped = TH.unsafeCodeCoerce . TH.lift
8483
#elif MIN_VERSION_template_haskell(2,16,0)
@@ -103,8 +102,7 @@ pattern PS { unPS } <- PosixString unPS where
103102
#endif
104103

105104
instance Lift PosixString where
106-
lift (PosixString bs)
107-
= [| PosixString (BS.pack $(lift $ BS.unpack bs)) :: PosixString |]
105+
lift (PosixString bs) = TH.AppE (TH.ConE 'PosixString) <$> (lift bs)
108106
#if MIN_VERSION_template_haskell(2,17,0)
109107
liftTyped = TH.unsafeCodeCoerce . TH.lift
110108
#elif MIN_VERSION_template_haskell(2,16,0)
@@ -197,9 +195,9 @@ instance Semigroup OsString where
197195
instance Lift OsString where
198196
lift xs = case coercionToPlatformTypes of
199197
Left (_, co) ->
200-
[| OsString (WindowsString (BS.pack $(lift $ BS.unpack $ coerce $ coerceWith co xs))) :: OsString |]
201-
Right (_, co) ->
202-
[| OsString (PosixString (BS.pack $(lift $ BS.unpack $ coerce $ coerceWith co xs))) :: OsString |]
198+
TH.AppE (TH.ConE 'OsString) <$> (lift $ coerceWith co xs)
199+
Right (_, co) -> do
200+
TH.AppE (TH.ConE 'OsString) <$> (lift $ coerceWith co xs)
203201
#if MIN_VERSION_template_haskell(2,17,0)
204202
liftTyped = TH.unsafeCodeCoerce . TH.lift
205203
#elif MIN_VERSION_template_haskell(2,16,0)

0 commit comments

Comments
 (0)