Skip to content

Commit

Permalink
Make OsString Lift instance compatible with GHC-8.10
Browse files Browse the repository at this point in the history
  • Loading branch information
hasufell committed Jun 24, 2024
1 parent 7d4a574 commit a9702f0
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions System/OsString/Internal/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@ pattern WS { unWS } <- WindowsString unWS where


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

instance Lift PosixString where
lift (PosixString bs)
= [| PosixString (BS.pack $(lift $ BS.unpack bs)) :: PosixString |]
lift (PosixString bs) = TH.AppE (TH.ConE 'PosixString) <$> (lift bs)
#if MIN_VERSION_template_haskell(2,17,0)
liftTyped = TH.unsafeCodeCoerce . TH.lift
#elif MIN_VERSION_template_haskell(2,16,0)
Expand Down Expand Up @@ -197,9 +195,9 @@ instance Semigroup OsString where
instance Lift OsString where
lift xs = case coercionToPlatformTypes of
Left (_, co) ->
[| OsString (WindowsString (BS.pack $(lift $ BS.unpack $ coerce $ coerceWith co xs))) :: OsString |]
Right (_, co) ->
[| OsString (PosixString (BS.pack $(lift $ BS.unpack $ coerce $ coerceWith co xs))) :: OsString |]
TH.AppE (TH.ConE 'OsString) <$> (lift $ coerceWith co xs)
Right (_, co) -> do
TH.AppE (TH.ConE 'OsString) <$> (lift $ coerceWith co xs)
#if MIN_VERSION_template_haskell(2,17,0)
liftTyped = TH.unsafeCodeCoerce . TH.lift
#elif MIN_VERSION_template_haskell(2,16,0)
Expand Down

0 comments on commit a9702f0

Please sign in to comment.