{-# language DataKinds #-}
{-# language DeriveAnyClass #-}
{-# language DerivingStrategies #-}
{-# language GADTs #-}
{-# language KindSignatures #-}
{-# language StandaloneDeriving #-}
module Socket.Datagram
( SendException(..)
, ReceiveException(..)
, SocketException(..)
) where
import Socket (Interruptibility(..))
import Socket.IPv4 (SocketException(..))
import Data.Kind (Type)
import Data.Typeable (Typeable)
import Control.Exception (Exception)
data SendException :: Interruptibility -> Type where
SendTruncated :: !Int -> SendException i
SendBroadcasted :: SendException i
SendInterrupted :: SendException 'Interruptible
deriving stock instance Show (SendException i)
deriving anyclass instance (Typeable i) => Exception (SendException i)
data ReceiveException :: Interruptibility -> Type where
ReceiveTruncated :: !Int -> ReceiveException i
ReceiveInterrupted :: ReceiveException 'Interruptible
deriving stock instance Show (ReceiveException i)
deriving anyclass instance (Typeable i) => Exception (ReceiveException i)