{-# LANGUAGE CPP #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE PackageImports #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE PatternSynonyms #-}
module System.OsString.Internal.Types
(
WindowsString(..)
, pattern WS
, unWS
, PosixString(..)
, unPS
, pattern PS
, PlatformString
, WindowsChar(..)
, unWW
, pattern WW
, PosixChar(..)
, unPW
, pattern PW
, PlatformChar
, OsString(..)
, OsChar(..)
)
where
import Control.DeepSeq
import Data.Data
import Data.Word
import Language.Haskell.TH.Syntax
( Lift (..), lift )
#if !MIN_VERSION_base(4,11,0)
import Data.Semigroup
#endif
import GHC.Generics (Generic)
import qualified System.OsPath.Data.ByteString.Short as BS
#if MIN_VERSION_template_haskell(2,16,0)
import qualified Language.Haskell.TH.Syntax as TH
#endif
newtype WindowsString = WindowsString { WindowsString -> ShortByteString
getWindowsString :: BS.ShortByteString }
deriving (WindowsString -> WindowsString -> Bool
(WindowsString -> WindowsString -> Bool)
-> (WindowsString -> WindowsString -> Bool) -> Eq WindowsString
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WindowsString -> WindowsString -> Bool
$c/= :: WindowsString -> WindowsString -> Bool
== :: WindowsString -> WindowsString -> Bool
$c== :: WindowsString -> WindowsString -> Bool
Eq, Eq WindowsString
Eq WindowsString
-> (WindowsString -> WindowsString -> Ordering)
-> (WindowsString -> WindowsString -> Bool)
-> (WindowsString -> WindowsString -> Bool)
-> (WindowsString -> WindowsString -> Bool)
-> (WindowsString -> WindowsString -> Bool)
-> (WindowsString -> WindowsString -> WindowsString)
-> (WindowsString -> WindowsString -> WindowsString)
-> Ord WindowsString
WindowsString -> WindowsString -> Bool
WindowsString -> WindowsString -> Ordering
WindowsString -> WindowsString -> WindowsString
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: WindowsString -> WindowsString -> WindowsString
$cmin :: WindowsString -> WindowsString -> WindowsString
max :: WindowsString -> WindowsString -> WindowsString
$cmax :: WindowsString -> WindowsString -> WindowsString
>= :: WindowsString -> WindowsString -> Bool
$c>= :: WindowsString -> WindowsString -> Bool
> :: WindowsString -> WindowsString -> Bool
$c> :: WindowsString -> WindowsString -> Bool
<= :: WindowsString -> WindowsString -> Bool
$c<= :: WindowsString -> WindowsString -> Bool
< :: WindowsString -> WindowsString -> Bool
$c< :: WindowsString -> WindowsString -> Bool
compare :: WindowsString -> WindowsString -> Ordering
$ccompare :: WindowsString -> WindowsString -> Ordering
$cp1Ord :: Eq WindowsString
Ord, Int -> WindowsString -> ShowS
[WindowsString] -> ShowS
WindowsString -> String
(Int -> WindowsString -> ShowS)
-> (WindowsString -> String)
-> ([WindowsString] -> ShowS)
-> Show WindowsString
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WindowsString] -> ShowS
$cshowList :: [WindowsString] -> ShowS
show :: WindowsString -> String
$cshow :: WindowsString -> String
showsPrec :: Int -> WindowsString -> ShowS
$cshowsPrec :: Int -> WindowsString -> ShowS
Show, b -> WindowsString -> WindowsString
NonEmpty WindowsString -> WindowsString
WindowsString -> WindowsString -> WindowsString
(WindowsString -> WindowsString -> WindowsString)
-> (NonEmpty WindowsString -> WindowsString)
-> (forall b. Integral b => b -> WindowsString -> WindowsString)
-> Semigroup WindowsString
forall b. Integral b => b -> WindowsString -> WindowsString
forall a.
(a -> a -> a)
-> (NonEmpty a -> a)
-> (forall b. Integral b => b -> a -> a)
-> Semigroup a
stimes :: b -> WindowsString -> WindowsString
$cstimes :: forall b. Integral b => b -> WindowsString -> WindowsString
sconcat :: NonEmpty WindowsString -> WindowsString
$csconcat :: NonEmpty WindowsString -> WindowsString
<> :: WindowsString -> WindowsString -> WindowsString
$c<> :: WindowsString -> WindowsString -> WindowsString
Semigroup, Semigroup WindowsString
WindowsString
Semigroup WindowsString
-> WindowsString
-> (WindowsString -> WindowsString -> WindowsString)
-> ([WindowsString] -> WindowsString)
-> Monoid WindowsString
[WindowsString] -> WindowsString
WindowsString -> WindowsString -> WindowsString
forall a.
Semigroup a -> a -> (a -> a -> a) -> ([a] -> a) -> Monoid a
mconcat :: [WindowsString] -> WindowsString
$cmconcat :: [WindowsString] -> WindowsString
mappend :: WindowsString -> WindowsString -> WindowsString
$cmappend :: WindowsString -> WindowsString -> WindowsString
mempty :: WindowsString
$cmempty :: WindowsString
$cp1Monoid :: Semigroup WindowsString
Monoid, Typeable, (forall x. WindowsString -> Rep WindowsString x)
-> (forall x. Rep WindowsString x -> WindowsString)
-> Generic WindowsString
forall x. Rep WindowsString x -> WindowsString
forall x. WindowsString -> Rep WindowsString x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep WindowsString x -> WindowsString
$cfrom :: forall x. WindowsString -> Rep WindowsString x
Generic, WindowsString -> ()
(WindowsString -> ()) -> NFData WindowsString
forall a. (a -> ()) -> NFData a
rnf :: WindowsString -> ()
$crnf :: WindowsString -> ()
NFData)
pattern WS :: BS.ShortByteString -> WindowsString
pattern $bWS :: ShortByteString -> WindowsString
$mWS :: forall r.
WindowsString -> (ShortByteString -> r) -> (Void# -> r) -> r
WS { WindowsString -> ShortByteString
unWS } <- WindowsString unWS where
WS ShortByteString
a = ShortByteString -> WindowsString
WindowsString ShortByteString
a
{-# COMPLETE WS #-}
instance Lift WindowsString where
lift :: WindowsString -> Q Exp
lift (WindowsString ShortByteString
bs)
= [| WindowsString (BS.pack $(lift $ BS.unpack bs)) :: WindowsString |]
#if MIN_VERSION_template_haskell(2,17,0)
liftTyped = TH.unsafeCodeCoerce . TH.lift
#elif MIN_VERSION_template_haskell(2,16,0)
liftTyped :: WindowsString -> Q (TExp WindowsString)
liftTyped = Q Exp -> Q (TExp WindowsString)
forall a. Q Exp -> Q (TExp a)
TH.unsafeTExpCoerce (Q Exp -> Q (TExp WindowsString))
-> (WindowsString -> Q Exp)
-> WindowsString
-> Q (TExp WindowsString)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. WindowsString -> Q Exp
forall t. Lift t => t -> Q Exp
TH.lift
#endif
newtype PosixString = PosixString { PosixString -> ShortByteString
getPosixString :: BS.ShortByteString }
deriving (PosixString -> PosixString -> Bool
(PosixString -> PosixString -> Bool)
-> (PosixString -> PosixString -> Bool) -> Eq PosixString
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PosixString -> PosixString -> Bool
$c/= :: PosixString -> PosixString -> Bool
== :: PosixString -> PosixString -> Bool
$c== :: PosixString -> PosixString -> Bool
Eq, Eq PosixString
Eq PosixString
-> (PosixString -> PosixString -> Ordering)
-> (PosixString -> PosixString -> Bool)
-> (PosixString -> PosixString -> Bool)
-> (PosixString -> PosixString -> Bool)
-> (PosixString -> PosixString -> Bool)
-> (PosixString -> PosixString -> PosixString)
-> (PosixString -> PosixString -> PosixString)
-> Ord PosixString
PosixString -> PosixString -> Bool
PosixString -> PosixString -> Ordering
PosixString -> PosixString -> PosixString
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: PosixString -> PosixString -> PosixString
$cmin :: PosixString -> PosixString -> PosixString
max :: PosixString -> PosixString -> PosixString
$cmax :: PosixString -> PosixString -> PosixString
>= :: PosixString -> PosixString -> Bool
$c>= :: PosixString -> PosixString -> Bool
> :: PosixString -> PosixString -> Bool
$c> :: PosixString -> PosixString -> Bool
<= :: PosixString -> PosixString -> Bool
$c<= :: PosixString -> PosixString -> Bool
< :: PosixString -> PosixString -> Bool
$c< :: PosixString -> PosixString -> Bool
compare :: PosixString -> PosixString -> Ordering
$ccompare :: PosixString -> PosixString -> Ordering
$cp1Ord :: Eq PosixString
Ord, Int -> PosixString -> ShowS
[PosixString] -> ShowS
PosixString -> String
(Int -> PosixString -> ShowS)
-> (PosixString -> String)
-> ([PosixString] -> ShowS)
-> Show PosixString
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PosixString] -> ShowS
$cshowList :: [PosixString] -> ShowS
show :: PosixString -> String
$cshow :: PosixString -> String
showsPrec :: Int -> PosixString -> ShowS
$cshowsPrec :: Int -> PosixString -> ShowS
Show, b -> PosixString -> PosixString
NonEmpty PosixString -> PosixString
PosixString -> PosixString -> PosixString
(PosixString -> PosixString -> PosixString)
-> (NonEmpty PosixString -> PosixString)
-> (forall b. Integral b => b -> PosixString -> PosixString)
-> Semigroup PosixString
forall b. Integral b => b -> PosixString -> PosixString
forall a.
(a -> a -> a)
-> (NonEmpty a -> a)
-> (forall b. Integral b => b -> a -> a)
-> Semigroup a
stimes :: b -> PosixString -> PosixString
$cstimes :: forall b. Integral b => b -> PosixString -> PosixString
sconcat :: NonEmpty PosixString -> PosixString
$csconcat :: NonEmpty PosixString -> PosixString
<> :: PosixString -> PosixString -> PosixString
$c<> :: PosixString -> PosixString -> PosixString
Semigroup, Semigroup PosixString
PosixString
Semigroup PosixString
-> PosixString
-> (PosixString -> PosixString -> PosixString)
-> ([PosixString] -> PosixString)
-> Monoid PosixString
[PosixString] -> PosixString
PosixString -> PosixString -> PosixString
forall a.
Semigroup a -> a -> (a -> a -> a) -> ([a] -> a) -> Monoid a
mconcat :: [PosixString] -> PosixString
$cmconcat :: [PosixString] -> PosixString
mappend :: PosixString -> PosixString -> PosixString
$cmappend :: PosixString -> PosixString -> PosixString
mempty :: PosixString
$cmempty :: PosixString
$cp1Monoid :: Semigroup PosixString
Monoid, Typeable, (forall x. PosixString -> Rep PosixString x)
-> (forall x. Rep PosixString x -> PosixString)
-> Generic PosixString
forall x. Rep PosixString x -> PosixString
forall x. PosixString -> Rep PosixString x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PosixString x -> PosixString
$cfrom :: forall x. PosixString -> Rep PosixString x
Generic, PosixString -> ()
(PosixString -> ()) -> NFData PosixString
forall a. (a -> ()) -> NFData a
rnf :: PosixString -> ()
$crnf :: PosixString -> ()
NFData)
pattern PS :: BS.ShortByteString -> PosixString
pattern $bPS :: ShortByteString -> PosixString
$mPS :: forall r.
PosixString -> (ShortByteString -> r) -> (Void# -> r) -> r
PS { PosixString -> ShortByteString
unPS } <- PosixString unPS where
PS ShortByteString
a = ShortByteString -> PosixString
PosixString ShortByteString
a
{-# COMPLETE PS #-}
instance Lift PosixString where
lift :: PosixString -> Q Exp
lift (PosixString ShortByteString
bs)
= [| PosixString (BS.pack $(lift $ BS.unpack bs)) :: PosixString |]
#if MIN_VERSION_template_haskell(2,17,0)
liftTyped = TH.unsafeCodeCoerce . TH.lift
#elif MIN_VERSION_template_haskell(2,16,0)
liftTyped :: PosixString -> Q (TExp PosixString)
liftTyped = Q Exp -> Q (TExp PosixString)
forall a. Q Exp -> Q (TExp a)
TH.unsafeTExpCoerce (Q Exp -> Q (TExp PosixString))
-> (PosixString -> Q Exp) -> PosixString -> Q (TExp PosixString)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. PosixString -> Q Exp
forall t. Lift t => t -> Q Exp
TH.lift
#endif
#if defined(mingw32_HOST_OS) || defined(__MINGW32__)
type PlatformString = WindowsString
#else
type PlatformString = PosixString
#endif
newtype WindowsChar = WindowsChar { WindowsChar -> Word16
getWindowsChar :: Word16 }
deriving (WindowsChar -> WindowsChar -> Bool
(WindowsChar -> WindowsChar -> Bool)
-> (WindowsChar -> WindowsChar -> Bool) -> Eq WindowsChar
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WindowsChar -> WindowsChar -> Bool
$c/= :: WindowsChar -> WindowsChar -> Bool
== :: WindowsChar -> WindowsChar -> Bool
$c== :: WindowsChar -> WindowsChar -> Bool
Eq, Eq WindowsChar
Eq WindowsChar
-> (WindowsChar -> WindowsChar -> Ordering)
-> (WindowsChar -> WindowsChar -> Bool)
-> (WindowsChar -> WindowsChar -> Bool)
-> (WindowsChar -> WindowsChar -> Bool)
-> (WindowsChar -> WindowsChar -> Bool)
-> (WindowsChar -> WindowsChar -> WindowsChar)
-> (WindowsChar -> WindowsChar -> WindowsChar)
-> Ord WindowsChar
WindowsChar -> WindowsChar -> Bool
WindowsChar -> WindowsChar -> Ordering
WindowsChar -> WindowsChar -> WindowsChar
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: WindowsChar -> WindowsChar -> WindowsChar
$cmin :: WindowsChar -> WindowsChar -> WindowsChar
max :: WindowsChar -> WindowsChar -> WindowsChar
$cmax :: WindowsChar -> WindowsChar -> WindowsChar
>= :: WindowsChar -> WindowsChar -> Bool
$c>= :: WindowsChar -> WindowsChar -> Bool
> :: WindowsChar -> WindowsChar -> Bool
$c> :: WindowsChar -> WindowsChar -> Bool
<= :: WindowsChar -> WindowsChar -> Bool
$c<= :: WindowsChar -> WindowsChar -> Bool
< :: WindowsChar -> WindowsChar -> Bool
$c< :: WindowsChar -> WindowsChar -> Bool
compare :: WindowsChar -> WindowsChar -> Ordering
$ccompare :: WindowsChar -> WindowsChar -> Ordering
$cp1Ord :: Eq WindowsChar
Ord, Int -> WindowsChar -> ShowS
[WindowsChar] -> ShowS
WindowsChar -> String
(Int -> WindowsChar -> ShowS)
-> (WindowsChar -> String)
-> ([WindowsChar] -> ShowS)
-> Show WindowsChar
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WindowsChar] -> ShowS
$cshowList :: [WindowsChar] -> ShowS
show :: WindowsChar -> String
$cshow :: WindowsChar -> String
showsPrec :: Int -> WindowsChar -> ShowS
$cshowsPrec :: Int -> WindowsChar -> ShowS
Show, Typeable, (forall x. WindowsChar -> Rep WindowsChar x)
-> (forall x. Rep WindowsChar x -> WindowsChar)
-> Generic WindowsChar
forall x. Rep WindowsChar x -> WindowsChar
forall x. WindowsChar -> Rep WindowsChar x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep WindowsChar x -> WindowsChar
$cfrom :: forall x. WindowsChar -> Rep WindowsChar x
Generic, WindowsChar -> ()
(WindowsChar -> ()) -> NFData WindowsChar
forall a. (a -> ()) -> NFData a
rnf :: WindowsChar -> ()
$crnf :: WindowsChar -> ()
NFData)
newtype PosixChar = PosixChar { PosixChar -> Word8
getPosixChar :: Word8 }
deriving (PosixChar -> PosixChar -> Bool
(PosixChar -> PosixChar -> Bool)
-> (PosixChar -> PosixChar -> Bool) -> Eq PosixChar
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PosixChar -> PosixChar -> Bool
$c/= :: PosixChar -> PosixChar -> Bool
== :: PosixChar -> PosixChar -> Bool
$c== :: PosixChar -> PosixChar -> Bool
Eq, Eq PosixChar
Eq PosixChar
-> (PosixChar -> PosixChar -> Ordering)
-> (PosixChar -> PosixChar -> Bool)
-> (PosixChar -> PosixChar -> Bool)
-> (PosixChar -> PosixChar -> Bool)
-> (PosixChar -> PosixChar -> Bool)
-> (PosixChar -> PosixChar -> PosixChar)
-> (PosixChar -> PosixChar -> PosixChar)
-> Ord PosixChar
PosixChar -> PosixChar -> Bool
PosixChar -> PosixChar -> Ordering
PosixChar -> PosixChar -> PosixChar
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: PosixChar -> PosixChar -> PosixChar
$cmin :: PosixChar -> PosixChar -> PosixChar
max :: PosixChar -> PosixChar -> PosixChar
$cmax :: PosixChar -> PosixChar -> PosixChar
>= :: PosixChar -> PosixChar -> Bool
$c>= :: PosixChar -> PosixChar -> Bool
> :: PosixChar -> PosixChar -> Bool
$c> :: PosixChar -> PosixChar -> Bool
<= :: PosixChar -> PosixChar -> Bool
$c<= :: PosixChar -> PosixChar -> Bool
< :: PosixChar -> PosixChar -> Bool
$c< :: PosixChar -> PosixChar -> Bool
compare :: PosixChar -> PosixChar -> Ordering
$ccompare :: PosixChar -> PosixChar -> Ordering
$cp1Ord :: Eq PosixChar
Ord, Int -> PosixChar -> ShowS
[PosixChar] -> ShowS
PosixChar -> String
(Int -> PosixChar -> ShowS)
-> (PosixChar -> String)
-> ([PosixChar] -> ShowS)
-> Show PosixChar
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PosixChar] -> ShowS
$cshowList :: [PosixChar] -> ShowS
show :: PosixChar -> String
$cshow :: PosixChar -> String
showsPrec :: Int -> PosixChar -> ShowS
$cshowsPrec :: Int -> PosixChar -> ShowS
Show, Typeable, (forall x. PosixChar -> Rep PosixChar x)
-> (forall x. Rep PosixChar x -> PosixChar) -> Generic PosixChar
forall x. Rep PosixChar x -> PosixChar
forall x. PosixChar -> Rep PosixChar x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PosixChar x -> PosixChar
$cfrom :: forall x. PosixChar -> Rep PosixChar x
Generic, PosixChar -> ()
(PosixChar -> ()) -> NFData PosixChar
forall a. (a -> ()) -> NFData a
rnf :: PosixChar -> ()
$crnf :: PosixChar -> ()
NFData)
pattern WW :: Word16 -> WindowsChar
pattern $bWW :: Word16 -> WindowsChar
$mWW :: forall r. WindowsChar -> (Word16 -> r) -> (Void# -> r) -> r
WW { WindowsChar -> Word16
unWW } <- WindowsChar unWW where
WW Word16
a = Word16 -> WindowsChar
WindowsChar Word16
a
{-# COMPLETE WW #-}
pattern PW :: Word8 -> PosixChar
pattern $bPW :: Word8 -> PosixChar
$mPW :: forall r. PosixChar -> (Word8 -> r) -> (Void# -> r) -> r
PW { PosixChar -> Word8
unPW } <- PosixChar unPW where
PW Word8
a = Word8 -> PosixChar
PosixChar Word8
a
{-# COMPLETE PW #-}
#if defined(mingw32_HOST_OS) || defined(__MINGW32__)
type PlatformChar = WindowsChar
#else
type PlatformChar = PosixChar
#endif
newtype OsString = OsString { OsString -> PosixString
getOsString :: PlatformString }
deriving (Int -> OsString -> ShowS
[OsString] -> ShowS
OsString -> String
(Int -> OsString -> ShowS)
-> (OsString -> String) -> ([OsString] -> ShowS) -> Show OsString
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OsString] -> ShowS
$cshowList :: [OsString] -> ShowS
show :: OsString -> String
$cshow :: OsString -> String
showsPrec :: Int -> OsString -> ShowS
$cshowsPrec :: Int -> OsString -> ShowS
Show, Typeable, (forall x. OsString -> Rep OsString x)
-> (forall x. Rep OsString x -> OsString) -> Generic OsString
forall x. Rep OsString x -> OsString
forall x. OsString -> Rep OsString x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OsString x -> OsString
$cfrom :: forall x. OsString -> Rep OsString x
Generic, OsString -> ()
(OsString -> ()) -> NFData OsString
forall a. (a -> ()) -> NFData a
rnf :: OsString -> ()
$crnf :: OsString -> ()
NFData)
instance Eq OsString where
(OsString PosixString
a) == :: OsString -> OsString -> Bool
== (OsString PosixString
b) = PosixString
a PosixString -> PosixString -> Bool
forall a. Eq a => a -> a -> Bool
== PosixString
b
instance Ord OsString where
compare :: OsString -> OsString -> Ordering
compare (OsString PosixString
a) (OsString PosixString
b) = PosixString -> PosixString -> Ordering
forall a. Ord a => a -> a -> Ordering
compare PosixString
a PosixString
b
instance Monoid OsString where
#if defined(mingw32_HOST_OS) || defined(__MINGW32__)
mempty = OsString (WindowsString BS.empty)
#if MIN_VERSION_base(4,16,0)
mappend = (<>)
#else
mappend (OsString (WindowsString a)) (OsString (WindowsString b))
= OsString (WindowsString (mappend a b))
#endif
#else
mempty :: OsString
mempty = PosixString -> OsString
OsString (ShortByteString -> PosixString
PosixString ShortByteString
BS.empty)
#if MIN_VERSION_base(4,16,0)
mappend = (<>)
#else
mappend :: OsString -> OsString -> OsString
mappend (OsString (PosixString ShortByteString
a)) (OsString (PosixString ShortByteString
b))
= PosixString -> OsString
OsString (ShortByteString -> PosixString
PosixString (ShortByteString -> ShortByteString -> ShortByteString
forall a. Monoid a => a -> a -> a
mappend ShortByteString
a ShortByteString
b))
#endif
#endif
#if MIN_VERSION_base(4,11,0)
instance Semigroup OsString where
#if MIN_VERSION_base(4,16,0)
#if defined(mingw32_HOST_OS) || defined(__MINGW32__)
(<>) (OsString (WindowsString a)) (OsString (WindowsString b))
= OsString (WindowsString (mappend a b))
#else
(<>) (OsString (PosixString a)) (OsString (PosixString b))
= OsString (PosixString (mappend a b))
#endif
#else
<> :: OsString -> OsString -> OsString
(<>) = OsString -> OsString -> OsString
forall a. Monoid a => a -> a -> a
mappend
#endif
#endif
instance Lift OsString where
#if defined(mingw32_HOST_OS) || defined(__MINGW32__)
lift (OsString (WindowsString bs))
= [| OsString (WindowsString (BS.pack $(lift $ BS.unpack bs))) :: OsString |]
#else
lift :: OsString -> Q Exp
lift (OsString (PosixString ShortByteString
bs))
= [| OsString (PosixString (BS.pack $(lift $ BS.unpack bs))) :: OsString |]
#endif
#if MIN_VERSION_template_haskell(2,17,0)
liftTyped = TH.unsafeCodeCoerce . TH.lift
#elif MIN_VERSION_template_haskell(2,16,0)
liftTyped :: OsString -> Q (TExp OsString)
liftTyped = Q Exp -> Q (TExp OsString)
forall a. Q Exp -> Q (TExp a)
TH.unsafeTExpCoerce (Q Exp -> Q (TExp OsString))
-> (OsString -> Q Exp) -> OsString -> Q (TExp OsString)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. OsString -> Q Exp
forall t. Lift t => t -> Q Exp
TH.lift
#endif
newtype OsChar = OsChar { OsChar -> PosixChar
getOsChar :: PlatformChar }
deriving (Int -> OsChar -> ShowS
[OsChar] -> ShowS
OsChar -> String
(Int -> OsChar -> ShowS)
-> (OsChar -> String) -> ([OsChar] -> ShowS) -> Show OsChar
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OsChar] -> ShowS
$cshowList :: [OsChar] -> ShowS
show :: OsChar -> String
$cshow :: OsChar -> String
showsPrec :: Int -> OsChar -> ShowS
$cshowsPrec :: Int -> OsChar -> ShowS
Show, Typeable, (forall x. OsChar -> Rep OsChar x)
-> (forall x. Rep OsChar x -> OsChar) -> Generic OsChar
forall x. Rep OsChar x -> OsChar
forall x. OsChar -> Rep OsChar x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OsChar x -> OsChar
$cfrom :: forall x. OsChar -> Rep OsChar x
Generic, OsChar -> ()
(OsChar -> ()) -> NFData OsChar
forall a. (a -> ()) -> NFData a
rnf :: OsChar -> ()
$crnf :: OsChar -> ()
NFData)
instance Eq OsChar where
(OsChar PosixChar
a) == :: OsChar -> OsChar -> Bool
== (OsChar PosixChar
b) = PosixChar
a PosixChar -> PosixChar -> Bool
forall a. Eq a => a -> a -> Bool
== PosixChar
b
instance Ord OsChar where
compare :: OsChar -> OsChar -> Ordering
compare (OsChar PosixChar
a) (OsChar PosixChar
b) = PosixChar -> PosixChar -> Ordering
forall a. Ord a => a -> a -> Ordering
compare PosixChar
a PosixChar
b