1{-# LANGUAGE CPP #-} 2{-# LANGUAGE GeneralizedNewtypeDeriving #-} 3 4{-| 5This module re-exports the types from @System.Posix.Types@ on all platforms. 6 7On Windows 'UserID', 'GroupID' and 'LinkCount' are missing, so they are 8redefined by this module. 9-} 10module System.PosixCompat.Types ( 11 module System.Posix.Types 12#ifdef mingw32_HOST_OS 13 , UserID 14 , GroupID 15 , LinkCount 16#endif 17 ) where 18 19#ifdef mingw32_HOST_OS 20-- Since CIno (FileID's underlying type) reflects <sys/type.h> ino_t, 21-- which mingw defines as short int (int16), it must be overriden to 22-- match the size of windows fileIndex (word64). 23import System.Posix.Types 24 25import Data.Word (Word32) 26 27newtype UserID = UserID Word32 28 deriving (Eq, Ord, Enum, Bounded, Integral, Num, Real) 29instance Show UserID where show (UserID x) = show x 30instance Read UserID where readsPrec i s = [ (UserID x, s') 31 | (x,s') <- readsPrec i s] 32 33newtype GroupID = GroupID Word32 34 deriving (Eq, Ord, Enum, Bounded, Integral, Num, Real) 35instance Show GroupID where show (GroupID x) = show x 36instance Read GroupID where readsPrec i s = [ (GroupID x, s') 37 | (x,s') <- readsPrec i s] 38 39newtype LinkCount = LinkCount Word32 40 deriving (Eq, Ord, Enum, Bounded, Integral, Num, Real) 41instance Show LinkCount where show (LinkCount x) = show x 42instance Read LinkCount where readsPrec i s = [ (LinkCount x, s') 43 | (x,s') <- readsPrec i s] 44 45#else 46import System.Posix.Types 47#endif 48