System.OsString.Internal.Types

os-string-2.0.2.1: Library for manipulating Operating system strings.

Safe Haskell | None
Language | Haskell2010

System.OsString.Internal.Types

Synopsis

- newtype WindowsString = WindowsString {
  - getWindowsString :: ShortByteString
  }
- pattern WS :: ShortByteString -> WindowsString
- unWS :: WindowsString -> ShortByteString
- newtype PosixString = PosixString {
  - getPosixString :: ShortByteString
  }
- unPS :: PosixString -> ShortByteString
- pattern PS :: ShortByteString -> PosixString
- type PlatformString = PosixString
- newtype WindowsChar = WindowsChar {
  - getWindowsChar :: Word16
  }
- unWW :: WindowsChar -> Word16
- pattern WW :: Word16 -> WindowsChar
- newtype PosixChar = PosixChar {
  - getPosixChar :: Word8
  }
- unPW :: PosixChar -> Word8
- pattern PW :: Word8 -> PosixChar
- type PlatformChar = PosixChar
- newtype OsString = OsString {
  - getOsString :: PlatformString
  }
- newtype OsChar = OsChar {
  - getOsChar :: PlatformChar
  }
- coercionToPlatformTypes :: Either (Coercion OsChar WindowsChar, Coercion OsString WindowsString) (Coercion OsChar PosixChar, Coercion OsString PosixString)

# Documentation

newtype WindowsString #

Commonly used windows string as wide character bytes.

Constructors

WindowsString |
Fields getWindowsString :: ShortByteString

#### Instances

Instances details

Monoid WindowsString # |
Instance details Defined in System.OsString.Internal.Types Methods mempty :: WindowsString # mappend :: WindowsString -> WindowsString -> WindowsString # mconcat :: [WindowsString] -> WindowsString #
Semigroup WindowsString # |
Instance details Defined in System.OsString.Internal.Types Methods (<>) :: WindowsString -> WindowsString -> WindowsString # sconcat :: NonEmpty WindowsString -> WindowsString # stimes :: Integral b => b -> WindowsString -> WindowsString #
Generic WindowsString # |
Instance details Defined in System.OsString.Internal.Types Associated Types
type Rep WindowsString |
Instance details Defined in System.OsString.Internal.Types type Rep WindowsString = D1 ('MetaData "WindowsString" "System.OsString.Internal.Types" "os-string-2.0.2.1-Hjy1RWYob6R165kcPeCUb" 'True) (C1 ('MetaCons "WindowsString" 'PrefixI 'True) (S1 ('MetaSel ('Just "getWindowsString") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ShortByteString)))
Methods from :: WindowsString -> Rep WindowsString x # to :: Rep WindowsString x -> WindowsString #
Show WindowsString # | Decodes as UCS-2.
Instance details Defined in System.OsString.Internal.Types Methods showsPrec :: Int -> WindowsString -> ShowS # show :: WindowsString -> String # showList :: [WindowsString] -> ShowS #
NFData WindowsString # |
Instance details Defined in System.OsString.Internal.Types Methods rnf :: WindowsString -> () #
Eq WindowsString # |
Instance details Defined in System.OsString.Internal.Types Methods (==) :: WindowsString -> WindowsString -> Bool # (/=) :: WindowsString -> WindowsString -> Bool #
Ord WindowsString # |
Instance details Defined in System.OsString.Internal.Types Methods compare :: WindowsString -> WindowsString -> Ordering # (<) :: WindowsString -> WindowsString -> Bool # (<=) :: WindowsString -> WindowsString -> Bool # (>) :: WindowsString -> WindowsString -> Bool # (>=) :: WindowsString -> WindowsString -> Bool # max :: WindowsString -> WindowsString -> WindowsString # min :: WindowsString -> WindowsString -> WindowsString #
Lift WindowsString # |
Instance details Defined in System.OsString.Internal.Types Methods lift :: Quote m => WindowsString -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => WindowsString -> Code m WindowsString #
type Rep WindowsString # |
Instance details Defined in System.OsString.Internal.Types type Rep WindowsString = D1 ('MetaData "WindowsString" "System.OsString.Internal.Types" "os-string-2.0.2.1-Hjy1RWYob6R165kcPeCUb" 'True) (C1 ('MetaCons "WindowsString" 'PrefixI 'True) (S1 ('MetaSel ('Just "getWindowsString") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ShortByteString)))

pattern WS :: ShortByteString -> WindowsString #

Just a short bidirectional synonym for `WindowsString` constructor.

unWS :: WindowsString -> ShortByteString #

newtype PosixString #

Commonly used Posix string as uninterpreted `char[]` array.

Constructors

PosixString |
Fields getPosixString :: ShortByteString

#### Instances

Instances details

Monoid PosixString # |
Instance details Defined in System.OsString.Internal.Types Methods mempty :: PosixString # mappend :: PosixString -> PosixString -> PosixString # mconcat :: [PosixString] -> PosixString #
Semigroup PosixString # |
Instance details Defined in System.OsString.Internal.Types Methods (<>) :: PosixString -> PosixString -> PosixString # sconcat :: NonEmpty PosixString -> PosixString # stimes :: Integral b => b -> PosixString -> PosixString #
Generic PosixString # |
Instance details Defined in System.OsString.Internal.Types Associated Types
type Rep PosixString |
Instance details Defined in System.OsString.Internal.Types type Rep PosixString = D1 ('MetaData "PosixString" "System.OsString.Internal.Types" "os-string-2.0.2.1-Hjy1RWYob6R165kcPeCUb" 'True) (C1 ('MetaCons "PosixString" 'PrefixI 'True) (S1 ('MetaSel ('Just "getPosixString") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ShortByteString)))
Methods from :: PosixString -> Rep PosixString x # to :: Rep PosixString x -> PosixString #
Show PosixString # | Prints the raw bytes without decoding.
Instance details Defined in System.OsString.Internal.Types Methods showsPrec :: Int -> PosixString -> ShowS # show :: PosixString -> String # showList :: [PosixString] -> ShowS #
NFData PosixString # |
Instance details Defined in System.OsString.Internal.Types Methods rnf :: PosixString -> () #
Eq PosixString # |
Instance details Defined in System.OsString.Internal.Types Methods (==) :: PosixString -> PosixString -> Bool # (/=) :: PosixString -> PosixString -> Bool #
Ord PosixString # |
Instance details Defined in System.OsString.Internal.Types Methods compare :: PosixString -> PosixString -> Ordering # (<) :: PosixString -> PosixString -> Bool # (<=) :: PosixString -> PosixString -> Bool # (>) :: PosixString -> PosixString -> Bool # (>=) :: PosixString -> PosixString -> Bool # max :: PosixString -> PosixString -> PosixString # min :: PosixString -> PosixString -> PosixString #
Lift PosixString # |
Instance details Defined in System.OsString.Internal.Types Methods lift :: Quote m => PosixString -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => PosixString -> Code m PosixString #
type Rep PosixString # |
Instance details Defined in System.OsString.Internal.Types type Rep PosixString = D1 ('MetaData "PosixString" "System.OsString.Internal.Types" "os-string-2.0.2.1-Hjy1RWYob6R165kcPeCUb" 'True) (C1 ('MetaCons "PosixString" 'PrefixI 'True) (S1 ('MetaSel ('Just "getPosixString") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ShortByteString)))

unPS :: PosixString -> ShortByteString #

pattern PS :: ShortByteString -> PosixString #

Just a short bidirectional synonym for `PosixString` constructor.

type PlatformString = PosixString #

newtype WindowsChar #

Constructors

WindowsChar |
Fields getWindowsChar :: Word16

#### Instances

Instances details

Generic WindowsChar # |
Instance details Defined in System.OsString.Internal.Types Associated Types
type Rep WindowsChar |
Instance details Defined in System.OsString.Internal.Types type Rep WindowsChar = D1 ('MetaData "WindowsChar" "System.OsString.Internal.Types" "os-string-2.0.2.1-Hjy1RWYob6R165kcPeCUb" 'True) (C1 ('MetaCons "WindowsChar" 'PrefixI 'True) (S1 ('MetaSel ('Just "getWindowsChar") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word16)))
Methods from :: WindowsChar -> Rep WindowsChar x # to :: Rep WindowsChar x -> WindowsChar #
Show WindowsChar # |
Instance details Defined in System.OsString.Internal.Types Methods showsPrec :: Int -> WindowsChar -> ShowS # show :: WindowsChar -> String # showList :: [WindowsChar] -> ShowS #
NFData WindowsChar # |
Instance details Defined in System.OsString.Internal.Types Methods rnf :: WindowsChar -> () #
Eq WindowsChar # |
Instance details Defined in System.OsString.Internal.Types Methods (==) :: WindowsChar -> WindowsChar -> Bool # (/=) :: WindowsChar -> WindowsChar -> Bool #
Ord WindowsChar # |
Instance details Defined in System.OsString.Internal.Types Methods compare :: WindowsChar -> WindowsChar -> Ordering # (<) :: WindowsChar -> WindowsChar -> Bool # (<=) :: WindowsChar -> WindowsChar -> Bool # (>) :: WindowsChar -> WindowsChar -> Bool # (>=) :: WindowsChar -> WindowsChar -> Bool # max :: WindowsChar -> WindowsChar -> WindowsChar # min :: WindowsChar -> WindowsChar -> WindowsChar #
type Rep WindowsChar # |
Instance details Defined in System.OsString.Internal.Types type Rep WindowsChar = D1 ('MetaData "WindowsChar" "System.OsString.Internal.Types" "os-string-2.0.2.1-Hjy1RWYob6R165kcPeCUb" 'True) (C1 ('MetaCons "WindowsChar" 'PrefixI 'True) (S1 ('MetaSel ('Just "getWindowsChar") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word16)))

unWW :: WindowsChar -> Word16 #

pattern WW :: Word16 -> WindowsChar #

Just a short bidirectional synonym for `WindowsChar` constructor.

newtype PosixChar #

Constructors

PosixChar |
Fields getPosixChar :: Word8

#### Instances

Instances details

Generic PosixChar # |
Instance details Defined in System.OsString.Internal.Types Associated Types
type Rep PosixChar |
Instance details Defined in System.OsString.Internal.Types type Rep PosixChar = D1 ('MetaData "PosixChar" "System.OsString.Internal.Types" "os-string-2.0.2.1-Hjy1RWYob6R165kcPeCUb" 'True) (C1 ('MetaCons "PosixChar" 'PrefixI 'True) (S1 ('MetaSel ('Just "getPosixChar") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word8)))
Methods from :: PosixChar -> Rep PosixChar x # to :: Rep PosixChar x -> PosixChar #
Show PosixChar # |
Instance details Defined in System.OsString.Internal.Types Methods showsPrec :: Int -> PosixChar -> ShowS # show :: PosixChar -> String # showList :: [PosixChar] -> ShowS #
NFData PosixChar # |
Instance details Defined in System.OsString.Internal.Types Methods rnf :: PosixChar -> () #
Eq PosixChar # |
Instance details Defined in System.OsString.Internal.Types Methods (==) :: PosixChar -> PosixChar -> Bool # (/=) :: PosixChar -> PosixChar -> Bool #
Ord PosixChar # |
Instance details Defined in System.OsString.Internal.Types Methods compare :: PosixChar -> PosixChar -> Ordering # (<) :: PosixChar -> PosixChar -> Bool # (<=) :: PosixChar -> PosixChar -> Bool # (>) :: PosixChar -> PosixChar -> Bool # (>=) :: PosixChar -> PosixChar -> Bool # max :: PosixChar -> PosixChar -> PosixChar # min :: PosixChar -> PosixChar -> PosixChar #
type Rep PosixChar # |
Instance details Defined in System.OsString.Internal.Types type Rep PosixChar = D1 ('MetaData "PosixChar" "System.OsString.Internal.Types" "os-string-2.0.2.1-Hjy1RWYob6R165kcPeCUb" 'True) (C1 ('MetaCons "PosixChar" 'PrefixI 'True) (S1 ('MetaSel ('Just "getPosixChar") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word8)))

unPW :: PosixChar -> Word8 #

pattern PW :: Word8 -> PosixChar #

Just a short bidirectional synonym for `PosixChar` constructor.

type PlatformChar = PosixChar #

newtype OsString #

Newtype representing short operating system specific strings.

Internally this is either `WindowsString` or `PosixString`, depending on the platform. Both use unpinned `ShortByteString` for efficiency.

The constructor is only exported via System.OsString.Internal.Types, since dealing with the internals isn't generally recommended, but supported in case you need to write platform specific code.

Constructors

OsString |
Fields getOsString :: PlatformString

#### Instances

Instances details

Monoid OsString # | "String-Concatenation" for `OsString`. This is not the same as `(</>)`.
Instance details Defined in System.OsString.Internal.Types Methods mempty :: OsString # mappend :: OsString -> OsString -> OsString # mconcat :: [OsString] -> OsString #
Semigroup OsString # |
Instance details Defined in System.OsString.Internal.Types Methods (<>) :: OsString -> OsString -> OsString # sconcat :: NonEmpty OsString -> OsString # stimes :: Integral b => b -> OsString -> OsString #
Generic OsString # |
Instance details Defined in System.OsString.Internal.Types Associated Types
type Rep OsString |
Instance details Defined in System.OsString.Internal.Types type Rep OsString = D1 ('MetaData "OsString" "System.OsString.Internal.Types" "os-string-2.0.2.1-Hjy1RWYob6R165kcPeCUb" 'True) (C1 ('MetaCons "OsString" 'PrefixI 'True) (S1 ('MetaSel ('Just "getOsString") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 PlatformString)))
Methods from :: OsString -> Rep OsString x # to :: Rep OsString x -> OsString #
Show OsString # | On windows, decodes as UCS-2. On unix prints the raw bytes without decoding.
Instance details Defined in System.OsString.Internal.Types Methods showsPrec :: Int -> OsString -> ShowS # show :: OsString -> String # showList :: [OsString] -> ShowS #
NFData OsString # |
Instance details Defined in System.OsString.Internal.Types Methods rnf :: OsString -> () #
Eq OsString # | Byte equality of the internal representation.
Instance details Defined in System.OsString.Internal.Types Methods (==) :: OsString -> OsString -> Bool # (/=) :: OsString -> OsString -> Bool #
Ord OsString # | Byte ordering of the internal representation.
Instance details Defined in System.OsString.Internal.Types Methods compare :: OsString -> OsString -> Ordering # (<) :: OsString -> OsString -> Bool # (<=) :: OsString -> OsString -> Bool # (>) :: OsString -> OsString -> Bool # (>=) :: OsString -> OsString -> Bool # max :: OsString -> OsString -> OsString # min :: OsString -> OsString -> OsString #
Lift OsString # |
Instance details Defined in System.OsString.Internal.Types Methods lift :: Quote m => OsString -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => OsString -> Code m OsString #
type Rep OsString # |
Instance details Defined in System.OsString.Internal.Types type Rep OsString = D1 ('MetaData "OsString" "System.OsString.Internal.Types" "os-string-2.0.2.1-Hjy1RWYob6R165kcPeCUb" 'True) (C1 ('MetaCons "OsString" 'PrefixI 'True) (S1 ('MetaSel ('Just "getOsString") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 PlatformString)))

newtype OsChar #

Newtype representing a code unit.

On Windows, this is restricted to two-octet codepoints `Word16`, on POSIX one-octet (`Word8`).

Constructors

OsChar |
Fields getOsChar :: PlatformChar

#### Instances

Instances details

Generic OsChar # |
Instance details Defined in System.OsString.Internal.Types Associated Types
type Rep OsChar |
Instance details Defined in System.OsString.Internal.Types type Rep OsChar = D1 ('MetaData "OsChar" "System.OsString.Internal.Types" "os-string-2.0.2.1-Hjy1RWYob6R165kcPeCUb" 'True) (C1 ('MetaCons "OsChar" 'PrefixI 'True) (S1 ('MetaSel ('Just "getOsChar") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 PlatformChar)))
Methods from :: OsChar -> Rep OsChar x # to :: Rep OsChar x -> OsChar #
Show OsChar # |
Instance details Defined in System.OsString.Internal.Types Methods showsPrec :: Int -> OsChar -> ShowS # show :: OsChar -> String # showList :: [OsChar] -> ShowS #
NFData OsChar # |
Instance details Defined in System.OsString.Internal.Types Methods rnf :: OsChar -> () #
Eq OsChar # | Byte equality of the internal representation.
Instance details Defined in System.OsString.Internal.Types Methods (==) :: OsChar -> OsChar -> Bool # (/=) :: OsChar -> OsChar -> Bool #
Ord OsChar # | Byte ordering of the internal representation.
Instance details Defined in System.OsString.Internal.Types Methods compare :: OsChar -> OsChar -> Ordering # (<) :: OsChar -> OsChar -> Bool # (<=) :: OsChar -> OsChar -> Bool # (>) :: OsChar -> OsChar -> Bool # (>=) :: OsChar -> OsChar -> Bool # max :: OsChar -> OsChar -> OsChar # min :: OsChar -> OsChar -> OsChar #
type Rep OsChar # |
Instance details Defined in System.OsString.Internal.Types type Rep OsChar = D1 ('MetaData "OsChar" "System.OsString.Internal.Types" "os-string-2.0.2.1-Hjy1RWYob6R165kcPeCUb" 'True) (C1 ('MetaCons "OsChar" 'PrefixI 'True) (S1 ('MetaSel ('Just "getOsChar") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 PlatformChar)))

coercionToPlatformTypes :: Either (Coercion OsChar WindowsChar, Coercion OsString WindowsString) (Coercion OsChar PosixChar, Coercion OsString PosixString) #

This is a type-level evidence that `OsChar` is a newtype wrapper over `WindowsChar` or `PosixChar` and `OsString` is a newtype wrapper over `WindowsString` or `PosixString`. If you pattern match on `coercionToPlatformTypes`, GHC will know that relevant types are coercible to each other. This helps to avoid CPP in certain scenarios.