Module
Test.Serialization.Symbiote
- Package
- purescript-symbiote
- Repository
- athanclark/purescript-symbiote
#SimpleSerialization Source
data SimpleSerialization a o op
The most trivial serialization medium for any a
.
Constructors
Instances
(Generic a a', Generic o o', Generic op op') => Generic (SimpleSerialization a o op) _
(Eq a, Eq o, Eq op) => Eq (SimpleSerialization a o op)
(Show a, Show o, Show op) => Show (SimpleSerialization a o op)
(SymbioteOperation a o op) => Symbiote a o op (SimpleSerialization a o op)
#firstPeer Source
firstPeer :: forall s m. MonadEffect m => MonadAff m => Show s => (First s -> m Unit) -> m (Second s) -> (Topic -> m Unit) -> (Failure Second s -> m Unit) -> (Topic -> Number -> m Unit) -> SymbioteT s m Unit -> m Unit
Run the test suite as the first peer - see 'Test.Serialization.Symbiote.WebSocket' for end-user implementations.
#secondPeer Source
secondPeer :: forall m s. MonadEffect m => MonadAff m => Show s => (Second s -> m Unit) -> m (First s) -> (Topic -> m Unit) -> (Failure First s -> m Unit) -> (Topic -> Number -> m Unit) -> SymbioteT s m Unit -> m Unit
Run the test suite as the second peer - see 'Test.Serialization.Symbiote.WebSocket' for end-user implementations.
#First Source
data First s
Messages sent by the first peer
Constructors
AvailableTopics (Map Topic Int)
FirstGenerating { generating :: Generating s, topic :: Topic }
FirstOperating { operating :: Operating s, topic :: Topic }
Instances
(Generic s s') => Generic (First s) _
(Eq s, Generic s s') => Eq (First s)
(Show s, Generic s s') => Show (First s)
(Arbitrary s) => Arbitrary (First s)
(EncodeJson s) => EncodeJson (First s)
(DecodeJson s) => DecodeJson (First s)
(DynamicByteLength s) => DynamicByteLength (First s)
(EncodeArrayBuffer s) => EncodeArrayBuffer (First s)
(DynamicByteLength s, DecodeArrayBuffer s) => DecodeArrayBuffer (First s)
#Second Source
data Second s
Messages sent by the second peer
Constructors
BadTopics (Map Topic Int)
Start
SecondOperating { operating :: Operating s, topic :: Topic }
SecondGenerating { generating :: Generating s, topic :: Topic }
Instances
(Generic s s') => Generic (Second s) _
(Eq s, Generic s s') => Eq (Second s)
(Show s, Generic s s') => Show (Second s)
(Arbitrary s) => Arbitrary (Second s)
(EncodeJson s) => EncodeJson (Second s)
(DecodeJson s) => DecodeJson (Second s)
(DynamicByteLength s) => DynamicByteLength (Second s)
(EncodeArrayBuffer s) => EncodeArrayBuffer (Second s)
(DynamicByteLength s, DecodeArrayBuffer s) => DecodeArrayBuffer (Second s)
#Generating Source
data Generating s
Messages sent by a peer during their generating phase
Constructors
Generated { operation :: s, value :: s }
BadResult s
YourTurn
ImFinished
GeneratingNoParseOperated s
Instances
(Generic s s') => Generic (Generating s) _
(Eq s, Generic s s') => Eq (Generating s)
(Show s, Generic s s') => Show (Generating s)
(Arbitrary s) => Arbitrary (Generating s)
(EncodeJson s) => EncodeJson (Generating s)
(DecodeJson s) => DecodeJson (Generating s)
(DynamicByteLength s) => DynamicByteLength (Generating s)
(EncodeArrayBuffer s) => EncodeArrayBuffer (Generating s)
(DynamicByteLength s, DecodeArrayBuffer s) => DecodeArrayBuffer (Generating s)
#Operating Source
data Operating s
Messages sent by a peer during their operating phase
Constructors
Instances
(Generic s s') => Generic (Operating s) _
(Eq s, Generic s s') => Eq (Operating s)
(Show s, Generic s s') => Show (Operating s)
(Arbitrary s) => Arbitrary (Operating s)
(EncodeJson s) => EncodeJson (Operating s)
(DecodeJson s) => DecodeJson (Operating s)
(DynamicByteLength s) => DynamicByteLength (Operating s)
(EncodeArrayBuffer s) => EncodeArrayBuffer (Operating s)
(DynamicByteLength s, DecodeArrayBuffer s) => DecodeArrayBuffer (Operating s)
#Failure Source
data Failure them s
Constructors
BadTopicsFailure { first :: Map Topic Int, second :: Map Topic Int }
OutOfSyncFirst (First s)
OutOfSyncSecond (Second s)
TopicNonexistent Topic
WrongTopic { expected :: Topic, got :: Topic }
CantParseOperated Topic s
CantParseGeneratedValue Topic s
CantParseLocalValue Topic s
CantParseLocalOperation Topic s
BadOperating Topic (Operating s)
BadGenerating Topic (Generating s)
BadThem Topic (them s)
SafeFailure { expected :: s, got :: s, topic :: Topic }
Instances
#nullProgress Source
nullProgress :: forall m. Applicative m => Topic -> Number -> m Unit
Do nothing
#simpleTest Source
simpleTest :: forall stM m s. MonadBaseControl Aff m stM => MonadAff m => MonadEffect m => Show s => SymbioteT s m Unit -> m Unit
Prints to stdout and uses a local channel for a sanity-check - doesn't serialize.
Re-exports from Test.Serialization.Symbiote.Core
#Symbiote Source
class (SymbioteOperation a o op) <= Symbiote a o op s | a -> op, op -> a, a -> o where
A serialization format for a particular type, and serialized data type.
Members
#SymbioteOperation Source
class SymbioteOperation a o op | a -> op, op -> a, a -> o where
A type-level relation between a type and appropriate, testable operations on that type.
Members
perform :: op -> a -> o