-- |
-- Module      : Relay.Reliable.Response
-- Description : Receiver-to-sender response on the reverse channel.
module Relay.Reliable.Response
  ( Response (..),
  )
where

import Relay.Session (Nat)

-- | A response travelling from receiver back to sender. v1 models the
-- cumulative acknowledgement only: @Ack n@ confirms that every frame
-- with sequence number @<= n@ has been contiguously received.
--
-- Monarch's wire type @NetRxResponse@ also carries terminal
-- @Reject@/@Closed@ variants; those sit outside the reliability
-- algebra and are modelled later, when we add shutdown.
newtype Response = Ack Nat
  deriving (Int -> Response -> ShowS
[Response] -> ShowS
Response -> String
(Int -> Response -> ShowS)
-> (Response -> String) -> ([Response] -> ShowS) -> Show Response
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Response -> ShowS
showsPrec :: Int -> Response -> ShowS
$cshow :: Response -> String
show :: Response -> String
$cshowList :: [Response] -> ShowS
showList :: [Response] -> ShowS
Show, Response -> Response -> Bool
(Response -> Response -> Bool)
-> (Response -> Response -> Bool) -> Eq Response
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Response -> Response -> Bool
== :: Response -> Response -> Bool
$c/= :: Response -> Response -> Bool
/= :: Response -> Response -> Bool
Eq)