| Copyright | (c) 2019 Athan Clark |
|---|---|
| License | BSD-3-Style |
| Maintainer | athan.clark@gmail.com |
| Portability | GHC |
| Safe Haskell | None |
| Language | Haskell2010 |
Test.Serialization.Symbiote.Core
Description
Synopsis
- class SymbioteOperation a o | a -> o where
- class SymbioteOperation a o => Symbiote a o s | a -> o where
- newtype Topic = Topic Text
- data SymbioteProtocol a s
- = MeGenerated {
- meGenValue :: a
- meGenOperation :: Operation a
- meGenReceived :: Maybe s
- | ThemGenerating { }
- | NotStarted
- | Finished
- = MeGenerated {
- data SymbioteGeneration a s = SymbioteGeneration {
- size :: Int
- protocol :: SymbioteProtocol a s
- newGeneration :: SymbioteGeneration a s
- data SymbioteState a o s = SymbioteState {
- generate :: Gen a
- generateOp :: Gen (Operation a)
- equal :: o -> o -> Bool
- maxSize :: Int
- generation :: TVar (SymbioteGeneration a s)
- encode' :: a -> s
- encodeOut' :: o -> s
- encodeOp' :: Operation a -> s
- decode' :: s -> Maybe a
- decodeOut' :: s -> Maybe o
- decodeOp' :: s -> Maybe (Operation a)
- perform' :: Operation a -> a -> o
- data ExistsSymbiote s = (Arbitrary a, Arbitrary (Operation a), Symbiote a o s, Eq o) => ExistsSymbiote (SymbioteState a o s)
- type SymbioteT s m = ReaderT Bool (StateT (Map Topic (ExistsSymbiote s)) m)
- runSymbioteT :: Monad m => SymbioteT s m () -> Bool -> m (Map Topic (ExistsSymbiote s))
- data GenerateSymbiote s
- = DoneGenerating
- | GeneratedSymbiote {
- generatedValue :: s
- generatedOperation :: s
- generateSymbiote :: forall s m. MonadIO m => ExistsSymbiote s -> m (GenerateSymbiote s)
- getProgress :: MonadIO m => ExistsSymbiote s -> m Float
Documentation
class SymbioteOperation a o | a -> o where Source #
A type-level relation between a type and appropriate, testable operations on that type.
Instances
class SymbioteOperation a o => Symbiote a o s | a -> o where Source #
A serialization format for a particular type, and serialized data type.
Methods
decode :: s -> Maybe a Source #
encodeOut :: Proxy a -> o -> s Source #
decodeOut :: Proxy a -> s -> Maybe o Source #
Instances
| (Serialize a, Serialize o, Serialize (Operation a), SymbioteOperation a o) => Symbiote a o ByteString Source # | |
Defined in Test.Serialization.Symbiote.Cereal.Lazy | |
| (Serialize a, Serialize o, Serialize (Operation a), SymbioteOperation a o) => Symbiote a o ByteString Source # | |
Defined in Test.Serialization.Symbiote.Cereal | |
| (ToJSON a, FromJSON a, ToJSON o, FromJSON o, ToJSON (Operation a), FromJSON (Operation a), SymbioteOperation a o) => Symbiote a o Value Source # | |
| SymbioteOperation a o => Symbiote a o (SimpleSerialization a o) Source # | |
Defined in Test.Serialization.Symbiote Methods encode :: a -> SimpleSerialization a o Source # decode :: SimpleSerialization a o -> Maybe a Source # encodeOut :: Proxy a -> o -> SimpleSerialization a o Source # decodeOut :: Proxy a -> SimpleSerialization a o -> Maybe o Source # encodeOp :: Operation a -> SimpleSerialization a o Source # decodeOp :: SimpleSerialization a o -> Maybe (Operation a) Source # | |
Unique name of a type, for a suite of tests
Instances
| Eq Topic Source # | |
| Ord Topic Source # | |
| Show Topic Source # | |
| IsString Topic Source # | |
Defined in Test.Serialization.Symbiote.Core Methods fromString :: String -> Topic # | |
| Arbitrary Topic Source # | |
| ToJSON Topic Source # | |
Defined in Test.Serialization.Symbiote.Core | |
| ToJSONKey Topic Source # | |
Defined in Test.Serialization.Symbiote.Core | |
| FromJSON Topic Source # | |
| FromJSONKey Topic Source # | |
Defined in Test.Serialization.Symbiote.Core | |
| Serialize Topic Source # | |
data SymbioteProtocol a s Source #
Protocol state for a particular topic
Constructors
| MeGenerated | |
Fields
| |
| ThemGenerating | |
| NotStarted | |
| Finished | |
data SymbioteGeneration a s Source #
Protocol generation state
Constructors
| SymbioteGeneration | |
Fields
| |
newGeneration :: SymbioteGeneration a s Source #
data SymbioteState a o s Source #
Internal existential state of a registered topic with type's facilities
Constructors
| SymbioteState | |
Fields
| |
data ExistsSymbiote s Source #
Constructors
| (Arbitrary a, Arbitrary (Operation a), Symbiote a o s, Eq o) => ExistsSymbiote (SymbioteState a o s) |
data GenerateSymbiote s Source #
Constructors
| DoneGenerating | |
| GeneratedSymbiote | |
Fields
| |
generateSymbiote :: forall s m. MonadIO m => ExistsSymbiote s -> m (GenerateSymbiote s) Source #
getProgress :: MonadIO m => ExistsSymbiote s -> m Float Source #