{-# LINE 1 "src/Linux/Socket/Types.hsc" #-}
{-# language DerivingStrategies #-}
{-# language GeneralizedNewtypeDeriving #-}
module Linux.Socket.Types
( SocketFlags(..)
, dontWait
, truncate
, closeOnExec
, nonblocking
) where
import Prelude hiding (truncate)
import Data.Bits (Bits((.|.)))
import Foreign.C.Types (CInt)
import Posix.Socket (MessageFlags(..))
newtype SocketFlags = SocketFlags CInt
deriving stock (Eq)
deriving newtype (Bits)
instance Semigroup SocketFlags where (<>) = (.|.)
instance Monoid SocketFlags where mempty = SocketFlags 0
dontWait :: MessageFlags m
dontWait = MessageFlags 64
{-# LINE 32 "src/Linux/Socket/Types.hsc" #-}
truncate :: MessageFlags m
truncate = MessageFlags 64
{-# LINE 36 "src/Linux/Socket/Types.hsc" #-}
closeOnExec :: SocketFlags
closeOnExec = SocketFlags 524288
{-# LINE 40 "src/Linux/Socket/Types.hsc" #-}
nonblocking :: SocketFlags
nonblocking = SocketFlags 2048
{-# LINE 44 "src/Linux/Socket/Types.hsc" #-}