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#ifdef mingw32_HOST_OS 12 module AllPosixTypesButFileID 13 , FileID 14 , UserID 15 , GroupID 16 , LinkCount 17#else 18 module System.Posix.Types 19#endif 20 ) where 21 22#ifdef mingw32_HOST_OS 23-- Since CIno (FileID's underlying type) reflects <sys/type.h> ino_t, 24-- which mingw defines as short int (int16), it must be overriden to 25-- match the size of windows fileIndex (word64). 26import System.Posix.Types as AllPosixTypesButFileID hiding (FileID) 27 28import Data.Word (Word32, Word64) 29 30newtype FileID = FileID Word64 31 deriving (Eq, Ord, Enum, Bounded, Integral, Num, Real) 32instance Show FileID where show (FileID x) = show x 33instance Read FileID where readsPrec i s = [ (FileID x, s') 34 | (x,s') <- readsPrec i s] 35 36newtype UserID = UserID Word32 37 deriving (Eq, Ord, Enum, Bounded, Integral, Num, Real) 38instance Show UserID where show (UserID x) = show x 39instance Read UserID where readsPrec i s = [ (UserID x, s') 40 | (x,s') <- readsPrec i s] 41 42newtype GroupID = GroupID Word32 43 deriving (Eq, Ord, Enum, Bounded, Integral, Num, Real) 44instance Show GroupID where show (GroupID x) = show x 45instance Read GroupID where readsPrec i s = [ (GroupID x, s') 46 | (x,s') <- readsPrec i s] 47 48newtype LinkCount = LinkCount Word32 49 deriving (Eq, Ord, Enum, Bounded, Integral, Num, Real) 50instance Show LinkCount where show (LinkCount x) = show x 51instance Read LinkCount where readsPrec i s = [ (LinkCount x, s') 52 | (x,s') <- readsPrec i s] 53 54#else 55import System.Posix.Types 56#endif 57