-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Armor data structures against serialization backwards compatibility problems
--
-- Tests the serialization backwards compatibility of data types by
-- storing serialized representations in .test files to be checked into
-- your project's version control.
@package armor
@version 0.1
module Armor
-- | Version numbers are simple monotonically increasing positive integers.
newtype Version a
Version :: Word -> Version a
[unVersion] :: Version a -> Word
-- | Core type class for armoring types. Includes a version and all the
-- type's serializations that you want to armor.
class Armored a
-- | Current version number for the data type.
version :: Armored a => Version a
-- | 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.
serializations :: Armored a => Map String (APrism' ByteString a)
-- | Config data for armor tests.
data ArmorConfig
ArmorConfig :: ArmorMode -> FilePath -> Maybe Word -> ArmorConfig
[acArmorMode] :: ArmorConfig -> ArmorMode
-- | Directory where all the test serializations are stored.
[acStoreDir] :: ArmorConfig -> FilePath
-- | How many versions back to test for backwards compatibility. A value of
-- Just 0 means that it only tests that the current version
-- satisfies parse . render == id. Just 1 means that it
-- will verify that the previous version can still be parse. Just
-- 2 the previous two versions, etc. Nothing means that all versions
-- will be tested.
[acNumVersions] :: ArmorConfig -> Maybe Word
-- | Default value for ArmorConfig.
defArmorConfig :: ArmorConfig
-- | 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.
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
instance GHC.Enum.Bounded Armor.ArmorMode
instance GHC.Enum.Enum Armor.ArmorMode
instance GHC.Read.Read Armor.ArmorMode
instance GHC.Show.Show Armor.ArmorMode
instance GHC.Classes.Ord Armor.ArmorMode
instance GHC.Classes.Eq Armor.ArmorMode
instance GHC.Read.Read (Armor.Version a)
instance GHC.Show.Show (Armor.Version a)
instance GHC.Classes.Ord (Armor.Version a)
instance GHC.Classes.Eq (Armor.Version a)