Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
- newtype Version a = Version {}
- class Armored a where
- data ArmorConfig = ArmorConfig {
- acArmorMode :: ArmorMode
- acStoreDir :: FilePath
- acNumVersions :: Maybe Word
- defArmorConfig :: ArmorConfig
- testArmor :: (Eq a, Show a, Typeable a, Armored a) => ArmorConfig -> String -> a -> Test
- testArmorMany :: (Eq a, Show a, Typeable a, Armored a) => ArmorConfig -> Map String a -> Test
Documentation
Version numbers are simple monotonically increasing positive integers.
class Armored a where Source #
Core type class for armoring types. Includes a version and all the type's serializations that you want to armor.
Current version number for the data type.
serializations :: Map String (APrism' ByteString a) Source #
Map of serializations keyed by a unique ID used to refer to each
serialization. A serialization is a tuple of (a -> ByteString)
and
(ByteString -> Maybe a)
. Represented here as a prism.
data ArmorConfig Source #
Config data for armor tests.
ArmorConfig | |
|
defArmorConfig :: ArmorConfig Source #
Default value for ArmorConfig.
testArmor :: (Eq a, Show a, Typeable a, Armored a) => ArmorConfig -> String -> a -> Test Source #
Tests the serialization backwards compatibility of a data type by storing serialized representations in .test files to be checked into your project's version control.
First, this function checks the directory acStoreDir
for the existence of
a file foo-000.test
. If it doesn't exist, it creates it for each
serialization with the serialized representation of the val parameter.
Next, it checks that the serialized formats in the most recent
acNumVersions
of the stored .test
files are parsable by the current
version of the serialization.