An abstraction of packet data within a SightedClient. This is a functional interface of
the form Packet => Option[WorldView => (WorldView, Cmd)]
.
Packet is the (super-)type of packets to abstract away, WorldView is SightedClient's view of the world corresponding to an abstraction and Cmd is a datatype that describes an effect to cause whenever a view modification takes place.
A "view modification" is a function of the form WorldView => (WorldView, Cmd)
. It arises as
a result of receiving packets, and is a function from the old WorldView to a pair of new
WorldView and an effect Cmd.
This functional object receives a packet and judges if the packet should invoke a view
modification. If so, it returns a Some[WorldView => (WorldView, Cmd)]
and None
otherwise.
- Companion
- object
Value members
Abstract methods
Concrete methods
"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.
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.
Lift the Cmd type to F[Cmd]
for some applicative type F.
Lift the Cmd type to F[Cmd]
for some applicative type F.
Lift the Cmd type to F[Cmd]
for some covariant applicative type F.
Lift the Cmd type to F[Cmd]
for some covariant applicative type F.
Obtain a new PacketAbstraction by mapping the output Cmd.
Obtain a new PacketAbstraction by mapping the output Cmd.
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.
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
, thenthis.viewUpdate(p)
- if otherwise
p: P
, thenanother.viewUpdate(p)
Widen the packet type to a type WPacket whose values can be narrowed down to Packet.
Widen the packet type to a type WPacket whose values can be narrowed down to Packet.