binary-tagged-0.2: Tagged binary serialisation.

Copyright(C) 2015 Oleg Grenrus
LicenseBSD3
MaintainerOleg Grenrus <oleg.grenrus@iki.fi>
Safe HaskellNone
LanguageHaskell2010

Data.Binary.Tagged

Contents

Description

Structurally tag binary serialisation stream.

Say you have:

data Record = Record
  { _recordFields :: HM.HashMap Text (Integer, ByteString)
  , _recordEnabled :: Bool
  }
  deriving (Eq, Show, Generic)

instance Binary Record
instance HasStructuralInfo Record
instance HasSemanticVersion Record

then you can serialise and deserialise Record values with a structure tag by simply

encodeTaggedFile "cachefile" record
decodeTaggedFile "cachefile" :: IO Record

If structure of Record changes in between, deserialisation will fail early.

Synopsis

Data

newtype BinaryTagged (v :: k) a Source #

Binary serialisable class, which tries to be less error-prone to data structure changes.

Values are serialised with header consisting of version v and hash of structuralInfo.

Constructors

BinaryTagged 

Fields

Instances
Generic1 (BinaryTagged v :: Type -> Type) Source # 
Instance details

Defined in Data.Binary.Tagged

Associated Types

type Rep1 (BinaryTagged v) :: k -> Type #

Methods

from1 :: BinaryTagged v a -> Rep1 (BinaryTagged v) a #

to1 :: Rep1 (BinaryTagged v) a -> BinaryTagged v a #

Monad (BinaryTagged v) Source # 
Instance details

Defined in Data.Binary.Tagged

Methods

(>>=) :: BinaryTagged v a -> (a -> BinaryTagged v b) -> BinaryTagged v b #

(>>) :: BinaryTagged v a -> BinaryTagged v b -> BinaryTagged v b #

return :: a -> BinaryTagged v a #

fail :: String -> BinaryTagged v a #

Functor (BinaryTagged v) Source # 
Instance details

Defined in Data.Binary.Tagged

Methods

fmap :: (a -> b) -> BinaryTagged v a -> BinaryTagged v b #

(<$) :: a -> BinaryTagged v b -> BinaryTagged v a #

Applicative (BinaryTagged v) Source # 
Instance details

Defined in Data.Binary.Tagged

Methods

pure :: a -> BinaryTagged v a #

(<*>) :: BinaryTagged v (a -> b) -> BinaryTagged v a -> BinaryTagged v b #

liftA2 :: (a -> b -> c) -> BinaryTagged v a -> BinaryTagged v b -> BinaryTagged v c #

(*>) :: BinaryTagged v a -> BinaryTagged v b -> BinaryTagged v b #

(<*) :: BinaryTagged v a -> BinaryTagged v b -> BinaryTagged v a #

Foldable (BinaryTagged v) Source # 
Instance details

Defined in Data.Binary.Tagged

Methods

fold :: Monoid m => BinaryTagged v m -> m #

foldMap :: Monoid m => (a -> m) -> BinaryTagged v a -> m #

foldr :: (a -> b -> b) -> b -> BinaryTagged v a -> b #

foldr' :: (a -> b -> b) -> b -> BinaryTagged v a -> b #

foldl :: (b -> a -> b) -> b -> BinaryTagged v a -> b #

foldl' :: (b -> a -> b) -> b -> BinaryTagged v a -> b #

foldr1 :: (a -> a -> a) -> BinaryTagged v a -> a #

foldl1 :: (a -> a -> a) -> BinaryTagged v a -> a #

toList :: BinaryTagged v a -> [a] #

null :: BinaryTagged v a -> Bool #

length :: BinaryTagged v a -> Int #

elem :: Eq a => a -> BinaryTagged v a -> Bool #

maximum :: Ord a => BinaryTagged v a -> a #

minimum :: Ord a => BinaryTagged v a -> a #

sum :: Num a => BinaryTagged v a -> a #

product :: Num a => BinaryTagged v a -> a #

Traversable (BinaryTagged v) Source # 
Instance details

Defined in Data.Binary.Tagged

Methods

traverse :: Applicative f => (a -> f b) -> BinaryTagged v a -> f (BinaryTagged v b) #

sequenceA :: Applicative f => BinaryTagged v (f a) -> f (BinaryTagged v a) #

mapM :: Monad m => (a -> m b) -> BinaryTagged v a -> m (BinaryTagged v b) #

sequence :: Monad m => BinaryTagged v (m a) -> m (BinaryTagged v a) #

Eq a => Eq (BinaryTagged v a) Source # 
Instance details

Defined in Data.Binary.Tagged

Methods

(==) :: BinaryTagged v a -> BinaryTagged v a -> Bool #

(/=) :: BinaryTagged v a -> BinaryTagged v a -> Bool #

Ord a => Ord (BinaryTagged v a) Source # 
Instance details

Defined in Data.Binary.Tagged

Read a => Read (BinaryTagged v a) Source # 
Instance details

Defined in Data.Binary.Tagged

Show a => Show (BinaryTagged v a) Source # 
Instance details

Defined in Data.Binary.Tagged

Generic (BinaryTagged v a) Source # 
Instance details

Defined in Data.Binary.Tagged

Associated Types

type Rep (BinaryTagged v a) :: Type -> Type #

Methods

from :: BinaryTagged v a -> Rep (BinaryTagged v a) x #

to :: Rep (BinaryTagged v a) x -> BinaryTagged v a #

Semigroup a => Semigroup (BinaryTagged v a) Source # 
Instance details

Defined in Data.Binary.Tagged

Methods

(<>) :: BinaryTagged v a -> BinaryTagged v a -> BinaryTagged v a #

sconcat :: NonEmpty (BinaryTagged v a) -> BinaryTagged v a #

stimes :: Integral b => b -> BinaryTagged v a -> BinaryTagged v a #

Monoid a => Monoid (BinaryTagged v a) Source # 
Instance details

Defined in Data.Binary.Tagged

(Binary a, HasStructuralInfo a, KnownNat v) => Binary (BinaryTagged v a) Source #

Version and structure hash are prepended to serialised stream

Instance details

Defined in Data.Binary.Tagged

Methods

put :: BinaryTagged v a -> Put #

get :: Get (BinaryTagged v a) #

putList :: [BinaryTagged v a] -> Put #

type Rep1 (BinaryTagged v :: Type -> Type) Source # 
Instance details

Defined in Data.Binary.Tagged

type Rep1 (BinaryTagged v :: Type -> Type) = D1 (MetaData "BinaryTagged" "Data.Binary.Tagged" "binary-tagged-0.2-AbFnzaShcUwKiIPJAQm0rx" True) (C1 (MetaCons "BinaryTagged" PrefixI True) (S1 (MetaSel (Just "unBinaryTagged") NoSourceUnpackedness NoSourceStrictness DecidedLazy) Par1))
type Rep (BinaryTagged v a) Source # 
Instance details

Defined in Data.Binary.Tagged

type Rep (BinaryTagged v a) = D1 (MetaData "BinaryTagged" "Data.Binary.Tagged" "binary-tagged-0.2-AbFnzaShcUwKiIPJAQm0rx" True) (C1 (MetaCons "BinaryTagged" PrefixI True) (S1 (MetaSel (Just "unBinaryTagged") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a)))

data StructuralInfo Source #

Data type structure, with (some) nominal information.

Instances
Eq StructuralInfo Source # 
Instance details

Defined in Data.Binary.Tagged

Ord StructuralInfo Source # 
Instance details

Defined in Data.Binary.Tagged

Show StructuralInfo Source # 
Instance details

Defined in Data.Binary.Tagged

Generic StructuralInfo Source # 
Instance details

Defined in Data.Binary.Tagged

Associated Types

type Rep StructuralInfo :: Type -> Type #

Binary StructuralInfo Source # 
Instance details

Defined in Data.Binary.Tagged

HasSemanticVersion StructuralInfo Source # 
Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion StructuralInfo :: Nat Source #

HasStructuralInfo StructuralInfo Source # 
Instance details

Defined in Data.Binary.Tagged

type Rep StructuralInfo Source # 
Instance details

Defined in Data.Binary.Tagged

type SemanticVersion StructuralInfo Source # 
Instance details

Defined in Data.Binary.Tagged

Serialisation

taggedEncode :: forall a. (HasStructuralInfo a, HasSemanticVersion a, Binary a) => a -> ByteString Source #

Tagged version of encode

taggedDecode :: forall a. (HasStructuralInfo a, HasSemanticVersion a, Binary a) => ByteString -> a Source #

Tagged version of decode

IO functions for serialisation

taggedEncodeFile :: forall a. (HasStructuralInfo a, HasSemanticVersion a, Binary a) => FilePath -> a -> IO () Source #

Tagged version of encodeFile

taggedDecodeFile :: forall a. (HasStructuralInfo a, HasSemanticVersion a, Binary a) => FilePath -> IO a Source #

Tagged version of decodeFile

Class

class HasStructuralInfo a where Source #

Type class providing StructuralInfo for each data type.

For regular non-recursive ADTs HasStructuralInfo can be derived generically.

data Record = Record { a :: Int, b :: Bool, c :: [Char] } deriving (Generic)
instance hasStructuralInfo Record

For stable types, you can provide only type name

instance HasStructuralInfo Int where structuralInfo = ghcNominalType -- infer name from Generic information
instance HasStructuralInfo Integer where structuralInfo _ = NominalType "Integer"

Recursive type story is a bit sad atm. If the type structure is stable, you can do:

instance HasStructuralInfo a => HasStructuralInfo [a] where structuralInfo = ghcStructuralInfo1

Minimal complete definition

Nothing

Instances
HasStructuralInfo Bool Source # 
Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo Char Source # 
Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo Double Source #

Since binary-tagged-0.1.3.0

Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo Float Source #

Since binary-tagged-0.1.3.0

Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo Int Source # 
Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo Int8 Source # 
Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo Int16 Source # 
Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo Int32 Source # 
Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo Int64 Source # 
Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo Integer Source # 
Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo Natural Source #

Since binary-tagged-0.1.4.0

Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo Ordering Source #

Since binary-tagged-0.1.3.0

Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo Word Source # 
Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo Word8 Source # 
Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo Word16 Source # 
Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo Word32 Source # 
Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo Word64 Source # 
Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo () Source #

Since binary-tagged-0.1.3.0

Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo ByteString Source # 
Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo ByteString Source # 
Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo Text Source # 
Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo UTCTime Source # 
Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo Value Source # 
Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo Text Source # 
Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo E0 Source # 
Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo E1 Source # 
Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo E2 Source # 
Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo E3 Source # 
Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo E6 Source # 
Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo E9 Source # 
Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo E12 Source # 
Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo Version Source #

Since binary-tagged-0.1.3.0

Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo All Source #

Since binary-tagged-0.1.4.0

Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo Any Source #

Since binary-tagged-0.1.4.0

Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo IntSet Source # 
Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo LocalTime Source # 
Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo TimeOfDay Source # 
Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo TimeZone Source # 
Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo UniversalTime Source # 
Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo NominalDiffTime Source # 
Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo DiffTime Source # 
Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo Day Source # 
Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo StructuralInfo Source # 
Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo a => HasStructuralInfo [a] Source # 
Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo a => HasStructuralInfo (Maybe a) Source # 
Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo a => HasStructuralInfo (Ratio a) Source # 
Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo a => HasStructuralInfo (Fixed a) Source #

Since binary-tagged-0.1.3.0

Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo a => HasStructuralInfo (Min a) Source #

Since binary-tagged-0.1.4.0

Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo a => HasStructuralInfo (Max a) Source #

Since binary-tagged-0.1.4.0

Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo a => HasStructuralInfo (First a) Source #

Since binary-tagged-0.1.4.0

Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo a => HasStructuralInfo (Last a) Source #

Since binary-tagged-0.1.4.0

Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo a => HasStructuralInfo (WrappedMonoid a) Source #

Since binary-tagged-0.1.4.0

Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo a => HasStructuralInfo (Option a) Source #

Since binary-tagged-0.1.4.0

Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo a => HasStructuralInfo (First a) Source #

Since binary-tagged-0.1.4.0

Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo a => HasStructuralInfo (Last a) Source #

Since binary-tagged-0.1.4.0

Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo a => HasStructuralInfo (Dual a) Source #

Since binary-tagged-0.1.4.0

Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo a => HasStructuralInfo (Sum a) Source # 
Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo a => HasStructuralInfo (Product a) Source # 
Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo a => HasStructuralInfo (NonEmpty a) Source # 
Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo a => HasStructuralInfo (IntMap a) Source # 
Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo a => HasStructuralInfo (Seq a) Source # 
Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo a => HasStructuralInfo (Set a) Source # 
Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo a => HasStructuralInfo (HashSet a) Source # 
Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo a => HasStructuralInfo (Vector a) Source # 
Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo a => HasStructuralInfo (Vector a) Source # 
Instance details

Defined in Data.Binary.Tagged

HasStructuralInfo a => HasStructuralInfo (Vector a) Source # 
Instance details

Defined in Data.Binary.Tagged

(HasStructuralInfo a, HasStructuralInfo b) => HasStructuralInfo (Either a b) Source # 
Instance details

Defined in Data.Binary.Tagged

(HasStructuralInfo a, HasStructuralInfo b) => HasStructuralInfo (a, b) Source # 
Instance details

Defined in Data.Binary.Tagged

(HasStructuralInfo k, HasStructuralInfo v) => HasStructuralInfo (HashMap k v) Source # 
Instance details

Defined in Data.Binary.Tagged

(HasStructuralInfo k, HasStructuralInfo v) => HasStructuralInfo (Map k v) Source # 
Instance details

Defined in Data.Binary.Tagged

(HasStructuralInfo i, HasStructuralInfo e) => HasStructuralInfo (UArray i e) Source # 
Instance details

Defined in Data.Binary.Tagged

(HasStructuralInfo i, HasStructuralInfo e) => HasStructuralInfo (Array i e) Source # 
Instance details

Defined in Data.Binary.Tagged

(HasStructuralInfo a, HasStructuralInfo b, HasStructuralInfo c) => HasStructuralInfo (a, b, c) Source # 
Instance details

Defined in Data.Binary.Tagged

Methods

structuralInfo :: Proxy (a, b, c) -> StructuralInfo Source #

(HasStructuralInfo a, HasStructuralInfo b, HasStructuralInfo c, HasStructuralInfo d) => HasStructuralInfo (a, b, c, d) Source # 
Instance details

Defined in Data.Binary.Tagged

Methods

structuralInfo :: Proxy (a, b, c, d) -> StructuralInfo Source #

class KnownNat (SemanticVersion a) => HasSemanticVersion (a :: *) Source #

A helper type family for encodeTaggedFile and decodeTaggedFile.

The default definition is SemanticVersion a = 0

Associated Types

type SemanticVersion a :: Nat Source #

Instances
HasSemanticVersion Bool Source # 
Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion Bool :: Nat Source #

HasSemanticVersion Char Source # 
Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion Char :: Nat Source #

HasSemanticVersion Double Source #

Since binary-tagged-0.1.3.0

Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion Double :: Nat Source #

HasSemanticVersion Float Source #

Since binary-tagged-0.1.3.0

Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion Float :: Nat Source #

HasSemanticVersion Int Source # 
Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion Int :: Nat Source #

HasSemanticVersion Int8 Source # 
Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion Int8 :: Nat Source #

HasSemanticVersion Int16 Source # 
Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion Int16 :: Nat Source #

HasSemanticVersion Int32 Source # 
Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion Int32 :: Nat Source #

HasSemanticVersion Int64 Source # 
Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion Int64 :: Nat Source #

HasSemanticVersion Integer Source # 
Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion Integer :: Nat Source #

HasSemanticVersion Natural Source #

Since binary-tagged-0.1.4.0

Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion Natural :: Nat Source #

HasSemanticVersion Ordering Source #

Since binary-tagged-0.1.3.0

Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion Ordering :: Nat Source #

HasSemanticVersion Word Source # 
Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion Word :: Nat Source #

HasSemanticVersion Word8 Source # 
Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion Word8 :: Nat Source #

HasSemanticVersion Word16 Source # 
Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion Word16 :: Nat Source #

HasSemanticVersion Word32 Source # 
Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion Word32 :: Nat Source #

HasSemanticVersion Word64 Source # 
Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion Word64 :: Nat Source #

HasSemanticVersion () Source #

Since binary-tagged-0.1.3.0

Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion () :: Nat Source #

HasSemanticVersion ByteString Source # 
Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion ByteString :: Nat Source #

HasSemanticVersion ByteString Source # 
Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion ByteString :: Nat Source #

HasSemanticVersion Text Source # 
Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion Text :: Nat Source #

HasSemanticVersion UTCTime Source # 
Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion UTCTime :: Nat Source #

HasSemanticVersion Value Source # 
Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion Value :: Nat Source #

HasSemanticVersion Text Source # 
Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion Text :: Nat Source #

HasSemanticVersion Version Source #

Since binary-tagged-0.1.3.0

Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion Version :: Nat Source #

HasSemanticVersion All Source #

Since binary-tagged-0.1.4.0

Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion All :: Nat Source #

HasSemanticVersion Any Source #

Since binary-tagged-0.1.4.0

Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion Any :: Nat Source #

HasSemanticVersion IntSet Source # 
Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion IntSet :: Nat Source #

HasSemanticVersion LocalTime Source # 
Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion LocalTime :: Nat Source #

HasSemanticVersion TimeOfDay Source # 
Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion TimeOfDay :: Nat Source #

HasSemanticVersion TimeZone Source # 
Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion TimeZone :: Nat Source #

HasSemanticVersion UniversalTime Source # 
Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion UniversalTime :: Nat Source #

HasSemanticVersion NominalDiffTime Source # 
Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion NominalDiffTime :: Nat Source #

HasSemanticVersion DiffTime Source # 
Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion DiffTime :: Nat Source #

HasSemanticVersion Day Source # 
Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion Day :: Nat Source #

HasSemanticVersion StructuralInfo Source # 
Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion StructuralInfo :: Nat Source #

HasSemanticVersion a => HasSemanticVersion [a] Source # 
Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion [a] :: Nat Source #

HasSemanticVersion a => HasSemanticVersion (Maybe a) Source # 
Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion (Maybe a) :: Nat Source #

HasSemanticVersion a => HasSemanticVersion (Ratio a) Source # 
Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion (Ratio a) :: Nat Source #

HasSemanticVersion (Fixed a) Source #

Since binary-tagged-0.1.3.0

Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion (Fixed a) :: Nat Source #

HasSemanticVersion a => HasSemanticVersion (Min a) Source #

Since binary-tagged-0.1.4.0

Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion (Min a) :: Nat Source #

HasSemanticVersion a => HasSemanticVersion (Max a) Source #

Since binary-tagged-0.1.4.0

Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion (Max a) :: Nat Source #

HasSemanticVersion a => HasSemanticVersion (First a) Source #

Since binary-tagged-0.1.4.0

Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion (First a) :: Nat Source #

HasSemanticVersion a => HasSemanticVersion (Last a) Source #

Since binary-tagged-0.1.4.0

Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion (Last a) :: Nat Source #

HasSemanticVersion a => HasSemanticVersion (WrappedMonoid a) Source #

Since binary-tagged-0.1.4.0

Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion (WrappedMonoid a) :: Nat Source #

HasSemanticVersion a => HasSemanticVersion (Option a) Source #

Since binary-tagged-0.1.4.0

Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion (Option a) :: Nat Source #

HasSemanticVersion a => HasSemanticVersion (First a) Source #

Since binary-tagged-0.1.4.0

Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion (First a) :: Nat Source #

HasSemanticVersion a => HasSemanticVersion (Last a) Source #

Since binary-tagged-0.1.4.0

Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion (Last a) :: Nat Source #

HasSemanticVersion a => HasSemanticVersion (Dual a) Source #

Since binary-tagged-0.1.4.0

Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion (Dual a) :: Nat Source #

HasSemanticVersion a => HasSemanticVersion (Sum a) Source # 
Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion (Sum a) :: Nat Source #

HasSemanticVersion a => HasSemanticVersion (Product a) Source # 
Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion (Product a) :: Nat Source #

HasSemanticVersion a => HasSemanticVersion (NonEmpty a) Source # 
Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion (NonEmpty a) :: Nat Source #

HasSemanticVersion a => HasSemanticVersion (IntMap a) Source # 
Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion (IntMap a) :: Nat Source #

HasSemanticVersion a => HasSemanticVersion (Seq a) Source # 
Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion (Seq a) :: Nat Source #

HasSemanticVersion a => HasSemanticVersion (Set a) Source # 
Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion (Set a) :: Nat Source #

HasSemanticVersion a => HasSemanticVersion (HashSet a) Source # 
Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion (HashSet a) :: Nat Source #

HasSemanticVersion a => HasSemanticVersion (Vector a) Source # 
Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion (Vector a) :: Nat Source #

HasSemanticVersion a => HasSemanticVersion (Vector a) Source # 
Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion (Vector a) :: Nat Source #

HasSemanticVersion a => HasSemanticVersion (Vector a) Source # 
Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion (Vector a) :: Nat Source #

(HasSemanticVersion a, HasSemanticVersion b, KnownNat (SemanticVersion (Either a b))) => HasSemanticVersion (Either a b) Source # 
Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion (Either a b) :: Nat Source #

(HasSemanticVersion a, HasSemanticVersion b, KnownNat (SemanticVersion (a, b))) => HasSemanticVersion (a, b) Source # 
Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion (a, b) :: Nat Source #

(HasSemanticVersion k, HasSemanticVersion v, KnownNat (SemanticVersion (HashMap k v))) => HasSemanticVersion (HashMap k v) Source # 
Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion (HashMap k v) :: Nat Source #

(HasSemanticVersion k, HasSemanticVersion v, KnownNat (SemanticVersion (Map k v))) => HasSemanticVersion (Map k v) Source # 
Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion (Map k v) :: Nat Source #

(HasSemanticVersion i, HasSemanticVersion e, KnownNat (SemanticVersion (UArray i e))) => HasSemanticVersion (UArray i e) Source # 
Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion (UArray i e) :: Nat Source #

(HasSemanticVersion i, HasSemanticVersion e, KnownNat (SemanticVersion (Array i e))) => HasSemanticVersion (Array i e) Source # 
Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion (Array i e) :: Nat Source #

(HasSemanticVersion a, HasSemanticVersion b, HasSemanticVersion c, KnownNat (SemanticVersion (a, b, c))) => HasSemanticVersion (a, b, c) Source #

Since binary-tagged-0.1.3.0

Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion (a, b, c) :: Nat Source #

(HasSemanticVersion a, HasSemanticVersion b, HasSemanticVersion c, HasSemanticVersion d, KnownNat (SemanticVersion (a, b, c, d))) => HasSemanticVersion (a, b, c, d) Source #

Since binary-tagged-0.1.3.0

Instance details

Defined in Data.Binary.Tagged

Associated Types

type SemanticVersion (a, b, c, d) :: Nat Source #

type Version = Word32 Source #

Type the semantic version is serialised with.

Type level calculations

type Interleave (n :: Nat) (m :: Nat) = SumUpTo (n + m) + m Source #

Interleaving

3 | 9  .  .  .  .
2 | 5  8  .  .  .
1 | 2  4  7 11  .
0 | 0  1  3  6 10
-----------------
    0  1  2  3  4

This can be calculated by f x y = sum ([0..x+y]) + y

type SumUpTo (n :: Nat) = Div2 (n * (n + 1)) Source #

type family Div2 (n :: Nat) :: Nat where ... Source #

Equations

Div2 0 = 0 
Div2 1 = 0 
Div2 n = 1 + Div2 (n - 2) 

Generic derivation

GHC

SOP

SOP direct

Hash

structuralInfoSha1ByteStringDigest :: StructuralInfo -> ByteString Source #

Deprecated: Use structuralInfoSha1Digest directly