ProtocolPacketAbstraction

trait ProtocolPacketAbstraction[F[_], SBPackets <: Tuple, CBPackets <: Tuple, Packet, WorldView]()

A specialized PacketAbstraction which keeps track of protocol details.

These objects are better suited for composing packet abstractions compared to dealing with PacketAbstraction directly.

Companion
object
class Object
trait Matchable
class Any

Value members

Concrete methods

final
def defocus[BroaderView](lens: Lens[BroaderView, WorldView]): ProtocolPacketAbstraction[F, SBPackets, CBPackets, Packet, BroaderView]

"Defocus" this abstraction to deal with a larger view datatype BroaderView that contains more information than WorldView.

"Defocus" this abstraction to deal with a larger view datatype BroaderView that contains more information than WorldView.

final
def keepTrackOfViewChanges: ProtocolPacketAbstraction[F, SBPackets, CBPackets, Packet, NonEmptyList[WorldView]]

Construct an abstraction that keeps track of all past views. This may be better suited for debugging purposes.

Construct an abstraction that keeps track of all past views. This may be better suited for debugging purposes.

final
def orElseAbstract(another: ProtocolPacketAbstraction[F, SBPackets, CBPackets, Packet, WorldView]): ProtocolPacketAbstraction[F, SBPackets, CBPackets, Packet, WorldView]

Combine this abstraction with another. The obtained abstraction will attempt to update the view using another if this object rejects to update the view.

Combine this abstraction with another. The obtained abstraction will attempt to update the view using another if this object rejects to update the view.

final
def thenAbstract[P](another: ProtocolPacketAbstraction[F, SBPackets, CBPackets, P, WorldView])(using ng: NotGiven[P <:< Packet], ge: GivenEither[Typeable[Packet], Packet =:= Nothing]): ProtocolPacketAbstraction[F, SBPackets, CBPackets, P | Packet, WorldView]

Combine this with another abstraction that deals with a packet type P that is not a subtype of Packet. The result of a view update for a packet p of type Packet | P will be:

Combine this with another abstraction that deals with a packet type P that is not a subtype of Packet. The result of a view update for a packet p of type Packet | P will be:

  • if p: Packet, then this.viewUpdate(p)
  • if otherwise p: P, then another.viewUpdate(p)
final
def thenAbstractWithLens[P, MagnifiedView](another: ProtocolPacketAbstraction[F, SBPackets, CBPackets, P, MagnifiedView], lens: Lens[WorldView, MagnifiedView])(using ng: NotGiven[P <:< Packet], ge: GivenEither[Typeable[Packet], Packet =:= Nothing]): ProtocolPacketAbstraction[F, SBPackets, CBPackets, P | Packet, WorldView]

Combine this with another abstraction that deals with smaller view MagnifiedView of the world by applying thenAbstract to the defocused abstraction.

Combine this with another abstraction that deals with smaller view MagnifiedView of the world by applying thenAbstract to the defocused abstraction.

Abstract fields

val abstraction: PacketAbstraction[Packet, WorldView, F[List[WritablePacketIn[SBPackets]]]]