-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/

-- | Fast binary serialization
--   
--   Fast binary serialization
@package store
@version 0.5.1.1

module Data.Store.TH.Internal
deriveManyStoreFromStorable :: (Type -> Bool) -> Q [Dec]
deriveTupleStoreInstance :: Int -> Dec
deriveGenericInstance :: Cxt -> Type -> Dec
deriveManyStorePrimVector :: Q [Dec]
deriveManyStoreUnboxVector :: Q [Dec]
deriveStore :: Cxt -> Type -> [DataCon] -> Q Dec

-- | Given the name of a type, generate a Store instance for it, assuming
--   that all type variables also need to be Store instances.
--   
--   Note that when used with datatypes that require type variables, the
--   ScopedTypeVariables extension is required.
makeStore :: Name -> Q [Dec]
getAllInstanceTypes1 :: Name -> Q [Type]
isMonoType :: Type -> Bool
instance TH.Derive.Internal.Deriver (Data.Store.Impl.Store a)

-- | This module exports TH utilities intended to be useful to users.
--   
--   makeStore can be used to generate a Store instance for
--   types, when all the type variables also require Store
--   instances. If some do not, then instead use TH.Derive like
--   this:
--   
--   
--   {-# LANGUAGE TemplateHaskell #-}
--   {-# LANGUAGE ScopedTypeVariables #-}
--   
--   import TH.Derive
--   import Data.Store
--   
--   data Foo a = Foo a | Bar Int
--   
--   $($(derive [d|
--       instance Store a => Deriving (Store (Foo a))
--       |]))
--   
--   
--   Note that when used with datatypes that require type variables, the
--   ScopedTypeVariables extension is required.
--   
--   One advantage of using this Template Haskell definition of Store
--   instances is that in some cases they can be faster than the instances
--   defined via Generics. Specifically, sum types which can yield
--   ConstSize from size will be faster when used in
--   array-like types. The instances generated via generics always use
--   VarSize for sum types.
module Data.Store.TH

-- | Given the name of a type, generate a Store instance for it, assuming
--   that all type variables also need to be Store instances.
--   
--   Note that when used with datatypes that require type variables, the
--   ScopedTypeVariables extension is required.
makeStore :: Name -> Q [Dec]

-- | Test a Store instance using smallcheck and
--   hspec.
smallcheckManyStore :: Bool -> Int -> [TypeQ] -> ExpQ

-- | Check if a given value succeeds in decoding its encoded
--   representation.
checkRoundtrip :: (Eq a, Show a, Store a) => Bool -> a -> Bool
assertRoundtrip :: (Eq a, Show a, Store a, Monad m, Typeable a) => Bool -> a -> m ()

-- | Internal API for the store package. The functions here which are not
--   re-exported by Data.Store are less likely to have stable APIs.
--   
--   This module also defines most of the included Store instances,
--   for types from the base package and other commonly used packages
--   (bytestring, containers, text, time, etc).
module Data.Store.Internal

-- | Serializes a value to a ByteString. In order to do this, it
--   first allocates a ByteString of the correct size (based on
--   size), and then uses poke to fill it.
--   
--   Safety of this function depends on correctness of the Store
--   instance. If size returns a. The good news is that this isn't
--   an issue if you use well-tested manual instances (such as those from
--   this package) combined with auomatic definition of instances.
encode :: Store a => a -> ByteString

-- | Decodes a value from a ByteString. Returns an exception if
--   there's an error while decoding, or if decoding undershoots /
--   overshoots the end of the buffer.
decode :: Store a => ByteString -> Either PeekException a

-- | Decodes a value from a ByteString, potentially throwing
--   exceptions, and taking a Peek to run. It is an exception to not
--   consume all input.
decodeWith :: () => Peek a -> ByteString -> Either PeekException a

-- | Decodes a value from a ByteString, potentially throwing
--   exceptions. It is an exception to not consume all input.
decodeEx :: Store a => ByteString -> a

-- | Decodes a value from a ByteString, potentially throwing
--   exceptions, and taking a Peek to run. It is an exception to not
--   consume all input.
decodeExWith :: () => Peek a -> ByteString -> a

-- | Similar to decodeExWith, but it allows there to be more of the
--   buffer remaining. The Offset of the buffer contents immediately
--   after the decoded value is returned.
decodeExPortionWith :: () => Peek a -> ByteString -> (Offset, a)

-- | Decodes a value from a ByteString, potentially throwing
--   exceptions. It is an exception to not consume all input.
decodeIO :: Store a => ByteString -> IO a

-- | Decodes a value from a ByteString, potentially throwing
--   exceptions, and taking a Peek to run. It is an exception to not
--   consume all input.
decodeIOWith :: () => Peek a -> ByteString -> IO a

-- | Similar to decodeExPortionWith, but runs in the IO
--   monad.
decodeIOPortionWith :: () => Peek a -> ByteString -> IO (Offset, a)

-- | The Store typeclass provides efficient serialization and
--   deserialization to raw pointer addresses.
--   
--   The peek and poke methods should be defined such that
--    decodeEx (encode x) == x .
class Store a

-- | Yields the Size of the buffer, in bytes, required to store the
--   encoded representation of the type.
--   
--   Note that the correctness of this function is crucial for the safety
--   of poke, as it does not do any bounds checking. It is the
--   responsibility of the invoker of poke (encode and
--   similar functions) to ensure that there's enough space in the output
--   buffer. If poke writes beyond, then arbitrary memory can be
--   overwritten, causing undefined behavior and segmentation faults.
size :: Store a => Size a

-- | Serializes a value to bytes. It is the responsibility of the caller to
--   ensure that at least the number of bytes required by size are
--   available. These details are handled by encode and similar
--   utilities.
poke :: Store a => a -> Poke ()

-- | Serialized a value from bytes, throwing exceptions if it encounters
--   invalid data or runs out of input bytes.
peek :: Store a => Peek a

-- | Yields the Size of the buffer, in bytes, required to store the
--   encoded representation of the type.
--   
--   Note that the correctness of this function is crucial for the safety
--   of poke, as it does not do any bounds checking. It is the
--   responsibility of the invoker of poke (encode and
--   similar functions) to ensure that there's enough space in the output
--   buffer. If poke writes beyond, then arbitrary memory can be
--   overwritten, causing undefined behavior and segmentation faults.
size :: (Store a, Generic a, GStoreSize (Rep a)) => Size a

-- | Serializes a value to bytes. It is the responsibility of the caller to
--   ensure that at least the number of bytes required by size are
--   available. These details are handled by encode and similar
--   utilities.
poke :: (Store a, Generic a, GStorePoke (Rep a)) => a -> Poke ()

-- | Serialized a value from bytes, throwing exceptions if it encounters
--   invalid data or runs out of input bytes.
peek :: (Store a, Generic a, GStorePeek (Rep a)) => Peek a

-- | Poke actions are useful for building sequential serializers.
--   
--   They are actions which write values to bytes into memory specified by
--   a Ptr base. The Applicative and Monad instances
--   make it easy to write serializations, by keeping track of the
--   Offset of the current byte. They allow you to chain Poke
--   action such that subsequent Pokes write into subsequent
--   portions of the output.
data Poke a

-- | Peek actions are useful for building sequential deserializers.
--   
--   They are actions which read from memory and construct values from it.
--   The Applicative and Monad instances make it easy to
--   chain these together to get more complicated deserializers. This
--   machinery keeps track of the current Ptr and end-of-buffer
--   Ptr.
data Peek a

-- | Run the Peek action, with a Ptr to the end of the buffer
--   where data is poked, and a Ptr to the current position. The
--   result is the Ptr, along with a return value.
--   
--   May throw a PeekException if the memory contains invalid
--   values.
runPeek :: Peek a -> PeekState -> Ptr Word8 -> IO (PeekResult a)

-- | Exception thrown while running poke. Note that other types of
--   exceptions could also be thrown. Invocations of fail in the
--   Poke monad causes this exception to be thrown.
--   
--   PokeExceptions are not expected to occur in ordinary
--   circumstances, and usually indicate a programming error.
data PokeException
PokeException :: Offset -> Text -> PokeException
[pokeExByteIndex] :: PokeException -> Offset
[pokeExMessage] :: PokeException -> Text

-- | Throws a PokeException. These should be avoided when possible,
--   they usually indicate a programming error.
pokeException :: () => Text -> Poke a

-- | Exception thrown while running peek. Note that other types of
--   exceptions can also be thrown. Invocations of fail in the
--   Poke monad causes this exception to be thrown.
--   
--   PeekException is thrown when the data being decoded is invalid.
data PeekException
PeekException :: Offset -> Text -> PeekException
[peekExBytesFromEnd] :: PeekException -> Offset
[peekExMessage] :: PeekException -> Text

-- | Throws a PeekException.
peekException :: () => Text -> Peek a

-- | Throws a PeekException about an attempt to read too many bytes.
tooManyBytes :: () => Int -> Int -> String -> IO void

-- | Info about a type's serialized length. Either the length is known
--   independently of the value, or the length depends on the value.
data Size a
VarSize :: (a -> Int) -> Size a
ConstSize :: !Int -> Size a

-- | Get the number of bytes needed to store the given value. See
--   size.
getSize :: Store a => a -> Int

-- | Given a Size value and a value of the type a, returns
--   its Int size.
getSizeWith :: Size a -> a -> Int

-- | Create an aggregate Size by providing functions to split the
--   input into two pieces.
--   
--   If both of the types are ConstSize, the result is
--   ConstSize and the functions will not be used.
combineSize :: forall a b c. (Store a, Store b) => (c -> a) -> (c -> b) -> Size c

-- | Create an aggregate Size by providing functions to split the
--   input into two pieces, as well as Size values to use to measure
--   the results.
--   
--   If both of the input Size values are ConstSize, the
--   result is ConstSize and the functions will not be used.
combineSizeWith :: forall a b c. (c -> a) -> (c -> b) -> Size a -> Size b -> Size c

-- | Adds a constant amount to a Size value.
addSize :: Int -> Size a -> Size a

-- | Implement size for an IsSequence of Store
--   instances.
--   
--   Note that many monomorphic containers have more efficient
--   implementations (for example, via memcpy).
sizeSequence :: forall t. (IsSequence t, Store (Element t)) => Size t

-- | Implement poke for an IsSequence of Store
--   instances.
--   
--   Note that many monomorphic containers have more efficient
--   implementations (for example, via memcpy).
pokeSequence :: (IsSequence t, Store (Element t)) => t -> Poke ()

-- | Implement peek for an IsSequence of Store
--   instances.
--   
--   Note that many monomorphic containers have more efficient
--   implementations (for example, via memcpy).
peekSequence :: (IsSequence t, Store (Element t), Index t ~ Int) => Peek t

-- | Implement size for an IsSet of Store instances.
sizeSet :: forall t. (IsSet t, Store (Element t)) => Size t

-- | Implement poke for an IsSequence of Store
--   instances.
pokeSet :: (IsSet t, Store (Element t)) => t -> Poke ()

-- | Implement peek for an IsSequence of Store
--   instances.
peekSet :: (IsSet t, Store (Element t)) => Peek t

-- | Implement size for an IsMap of where both
--   ContainerKey and MapValue are Store instances.
sizeMap :: forall t. (Store (ContainerKey t), Store (MapValue t), IsMap t) => Size t

-- | Implement poke for an IsMap of where both
--   ContainerKey and MapValue are Store instances.
pokeMap :: (Store (ContainerKey t), Store (MapValue t), IsMap t) => t -> Poke ()

-- | Implement peek for an IsMap of where both
--   ContainerKey and MapValue are Store instances.
peekMap :: (Store (ContainerKey t), Store (MapValue t), IsMap t) => Peek t

-- | Like sizeMap but should only be used for ordered containers
--   where mapToList returns an ascending list.
sizeOrdMap :: forall t. (Store (ContainerKey t), Store (MapValue t), IsMap t) => Size t

-- | Like pokeMap but should only be used for ordered containers
--   where mapToList returns an ascending list.
pokeOrdMap :: (Store (ContainerKey t), Store (MapValue t), IsMap t) => t -> Poke ()

-- | Decode the results of pokeOrdMap using a given function to
--   construct the map.
peekOrdMapWith :: (Store (ContainerKey t), Store (MapValue t)) => ([(ContainerKey t, MapValue t)] -> t) -> Peek t
sizeArray :: (Ix i, IArray a e, Store i, Store e) => Size (a i e)
pokeArray :: (Ix i, IArray a e, Store i, Store e) => a i e -> Poke ()
peekArray :: (Ix i, IArray a e, Store i, Store e) => Peek (a i e)
class GStoreSize f
genericSize :: (Generic a, GStoreSize (Rep a)) => Size a
class GStorePoke f
genericPoke :: (Generic a, GStorePoke (Rep a)) => a -> Poke ()
class GStorePeek f
genericPeek :: (Generic a, GStorePeek (Rep a)) => Peek a

-- | Skip n bytes forward.
skip :: Int -> Peek ()

-- | Isolate the input to n bytes, skipping n bytes forward. Fails if
--   m advances the offset beyond the isolated region.
isolate :: Int -> Peek a -> Peek a

-- | Ensure the presence of a given magic value.
--   
--   Throws a PeekException if the value isn't present.
peekMagic :: (Eq a, Show a, Store a) => String -> a -> Peek ()
class KnownNat n => IsStaticSize n a
toStaticSize :: IsStaticSize n a => a -> Maybe (StaticSize n a)
newtype StaticSize (n :: Nat) a
StaticSize :: a -> StaticSize a
[unStaticSize] :: StaticSize a -> a
toStaticSizeEx :: IsStaticSize n a => a -> StaticSize n a
liftStaticSize :: forall n a. (KnownNat n, Lift a) => TypeQ -> StaticSize n a -> ExpQ
staticByteStringExp :: ByteString -> ExpQ
instance Data.Store.Impl.Store Language.Haskell.TH.Syntax.Info
instance Data.Store.Impl.Store Language.Haskell.TH.Syntax.Dec
instance Data.Store.Impl.Store Language.Haskell.TH.Syntax.Name
instance Data.Store.Impl.Store Language.Haskell.TH.Syntax.OccName
instance Data.Store.Impl.Store Language.Haskell.TH.Syntax.NameFlavour
instance Data.Store.Impl.Store Language.Haskell.TH.Syntax.Clause
instance Data.Store.Impl.Store Language.Haskell.TH.Syntax.Pat
instance Data.Store.Impl.Store Language.Haskell.TH.Syntax.Lit
instance Data.Store.Impl.Store Language.Haskell.TH.Syntax.Type
instance Data.Store.Impl.Store Language.Haskell.TH.Syntax.TyVarBndr
instance Data.Store.Impl.Store Language.Haskell.TH.Syntax.TyLit
instance Data.Store.Impl.Store Language.Haskell.TH.Syntax.Exp
instance Data.Store.Impl.Store Language.Haskell.TH.Syntax.Match
instance Data.Store.Impl.Store Language.Haskell.TH.Syntax.Body
instance Data.Store.Impl.Store Language.Haskell.TH.Syntax.Guard
instance Data.Store.Impl.Store Language.Haskell.TH.Syntax.Stmt
instance Data.Store.Impl.Store Language.Haskell.TH.Syntax.Range
instance Data.Store.Impl.Store Language.Haskell.TH.Syntax.Con
instance Data.Store.Impl.Store Language.Haskell.TH.Syntax.Bang
instance Data.Store.Impl.Store Language.Haskell.TH.Syntax.SourceUnpackedness
instance Data.Store.Impl.Store Language.Haskell.TH.Syntax.SourceStrictness
instance Data.Store.Impl.Store Language.Haskell.TH.Syntax.DerivClause
instance Data.Store.Impl.Store Language.Haskell.TH.Syntax.DerivStrategy
instance Data.Store.Impl.Store Language.Haskell.TH.Syntax.FunDep
instance Data.Store.Impl.Store Language.Haskell.TH.Syntax.Overlap
instance Data.Store.Impl.Store Language.Haskell.TH.Syntax.Foreign
instance Data.Store.Impl.Store Language.Haskell.TH.Syntax.Callconv
instance Data.Store.Impl.Store Language.Haskell.TH.Syntax.Safety
instance Data.Store.Impl.Store Language.Haskell.TH.Syntax.Fixity
instance Data.Store.Impl.Store Language.Haskell.TH.Syntax.FixityDirection
instance Data.Store.Impl.Store Language.Haskell.TH.Syntax.Pragma
instance Data.Store.Impl.Store Language.Haskell.TH.Syntax.Inline
instance Data.Store.Impl.Store Language.Haskell.TH.Syntax.RuleMatch
instance Data.Store.Impl.Store Language.Haskell.TH.Syntax.Phases
instance Data.Store.Impl.Store Language.Haskell.TH.Syntax.RuleBndr
instance Data.Store.Impl.Store Language.Haskell.TH.Syntax.AnnTarget
instance Data.Store.Impl.Store Language.Haskell.TH.Syntax.TySynEqn
instance Data.Store.Impl.Store Language.Haskell.TH.Syntax.TypeFamilyHead
instance Data.Store.Impl.Store Language.Haskell.TH.Syntax.FamilyResultSig
instance Data.Store.Impl.Store Language.Haskell.TH.Syntax.InjectivityAnn
instance Data.Store.Impl.Store Language.Haskell.TH.Syntax.Role
instance Data.Store.Impl.Store Language.Haskell.TH.Syntax.PatSynArgs
instance Data.Store.Impl.Store Language.Haskell.TH.Syntax.PatSynDir
instance Data.Store.Impl.Store Language.Haskell.TH.Syntax.ModName
instance Data.Store.Impl.Store Language.Haskell.TH.Syntax.NameSpace
instance Data.Store.Impl.Store Language.Haskell.TH.Syntax.PkgName
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector Foreign.C.Types.CBool)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector Foreign.C.Types.CChar)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector Foreign.C.Types.CClock)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector Foreign.C.Types.CDouble)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector Foreign.C.Types.CFloat)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector Foreign.C.Types.CInt)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector Foreign.C.Types.CIntMax)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector Foreign.C.Types.CIntPtr)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector Foreign.C.Types.CLLong)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector Foreign.C.Types.CLong)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector Foreign.C.Types.CPtrdiff)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector Foreign.C.Types.CSChar)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector Foreign.C.Types.CSUSeconds)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector Foreign.C.Types.CShort)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector Foreign.C.Types.CSigAtomic)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector Foreign.C.Types.CSize)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector Foreign.C.Types.CTime)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector Foreign.C.Types.CUChar)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector Foreign.C.Types.CUInt)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector Foreign.C.Types.CUIntMax)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector Foreign.C.Types.CUIntPtr)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector Foreign.C.Types.CULLong)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector Foreign.C.Types.CULong)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector Foreign.C.Types.CUSeconds)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector Foreign.C.Types.CUShort)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector Foreign.C.Types.CWchar)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector GHC.Int.Int16)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector GHC.Int.Int32)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector GHC.Int.Int64)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector GHC.Int.Int8)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector (GHC.Ptr.FunPtr a))
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector (GHC.Ptr.Ptr a))
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector GHC.Word.Word16)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector GHC.Word.Word32)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector GHC.Word.Word64)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector GHC.Word.Word8)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector System.Posix.Types.CBlkCnt)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector System.Posix.Types.CBlkSize)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector System.Posix.Types.CCc)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector System.Posix.Types.CClockId)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector System.Posix.Types.CDev)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector System.Posix.Types.CFsBlkCnt)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector System.Posix.Types.CFsFilCnt)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector System.Posix.Types.CGid)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector System.Posix.Types.CId)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector System.Posix.Types.CIno)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector System.Posix.Types.CKey)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector System.Posix.Types.CMode)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector System.Posix.Types.CNlink)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector System.Posix.Types.COff)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector System.Posix.Types.CPid)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector System.Posix.Types.CRLim)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector System.Posix.Types.CSpeed)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector System.Posix.Types.CSsize)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector System.Posix.Types.CTcflag)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector System.Posix.Types.CTimer)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector System.Posix.Types.CUid)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector System.Posix.Types.Fd)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector GHC.Types.Char)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector GHC.Types.Double)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector GHC.Types.Float)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector GHC.Types.Int)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector GHC.Types.Word)
instance Data.Store.Impl.Store (Data.Vector.Primitive.Vector Data.Primitive.Types.Addr)
instance Foreign.Storable.Storable a => Data.Store.Impl.Store (Data.Complex.Complex a)
instance Foreign.Storable.Storable a => Data.Store.Impl.Store (Data.Functor.Const.Const a b)
instance Foreign.Storable.Storable a => Data.Store.Impl.Store (Data.Functor.Identity.Identity a)
instance Data.Store.Impl.Store Foreign.C.Types.CBool
instance Data.Store.Impl.Store Foreign.C.Types.CChar
instance Data.Store.Impl.Store Foreign.C.Types.CClock
instance Data.Store.Impl.Store Foreign.C.Types.CDouble
instance Data.Store.Impl.Store Foreign.C.Types.CFloat
instance Data.Store.Impl.Store Foreign.C.Types.CInt
instance Data.Store.Impl.Store Foreign.C.Types.CIntMax
instance Data.Store.Impl.Store Foreign.C.Types.CIntPtr
instance Data.Store.Impl.Store Foreign.C.Types.CLLong
instance Data.Store.Impl.Store Foreign.C.Types.CLong
instance Data.Store.Impl.Store Foreign.C.Types.CPtrdiff
instance Data.Store.Impl.Store Foreign.C.Types.CSChar
instance Data.Store.Impl.Store Foreign.C.Types.CSUSeconds
instance Data.Store.Impl.Store Foreign.C.Types.CShort
instance Data.Store.Impl.Store Foreign.C.Types.CSigAtomic
instance Data.Store.Impl.Store Foreign.C.Types.CSize
instance Data.Store.Impl.Store Foreign.C.Types.CTime
instance Data.Store.Impl.Store Foreign.C.Types.CUChar
instance Data.Store.Impl.Store Foreign.C.Types.CUInt
instance Data.Store.Impl.Store Foreign.C.Types.CUIntMax
instance Data.Store.Impl.Store Foreign.C.Types.CUIntPtr
instance Data.Store.Impl.Store Foreign.C.Types.CULLong
instance Data.Store.Impl.Store Foreign.C.Types.CULong
instance Data.Store.Impl.Store Foreign.C.Types.CUSeconds
instance Data.Store.Impl.Store Foreign.C.Types.CUShort
instance Data.Store.Impl.Store Foreign.C.Types.CWchar
instance Data.Store.Impl.Store Foreign.Ptr.IntPtr
instance Data.Store.Impl.Store Foreign.Ptr.WordPtr
instance Data.Store.Impl.Store GHC.Fingerprint.Type.Fingerprint
instance Data.Store.Impl.Store GHC.Int.Int16
instance Data.Store.Impl.Store GHC.Int.Int32
instance Data.Store.Impl.Store GHC.Int.Int64
instance Data.Store.Impl.Store GHC.Int.Int8
instance Data.Store.Impl.Store (GHC.Ptr.FunPtr a)
instance Data.Store.Impl.Store (GHC.Ptr.Ptr a)
instance Data.Store.Impl.Store (GHC.Stable.StablePtr a)
instance Data.Store.Impl.Store GHC.Word.Word16
instance Data.Store.Impl.Store GHC.Word.Word32
instance Data.Store.Impl.Store GHC.Word.Word64
instance Data.Store.Impl.Store GHC.Word.Word8
instance Data.Store.Impl.Store System.Clock.TimeSpec
instance Data.Store.Impl.Store GHC.Types.Char
instance Data.Store.Impl.Store GHC.Types.Double
instance Data.Store.Impl.Store GHC.Types.Float
instance Data.Store.Impl.Store GHC.Types.Int
instance Data.Store.Impl.Store GHC.Types.Word
instance Data.Store.Impl.Store Network.Socket.Types.PortNumber
instance Data.Primitive.Types.Prim a => Data.Store.Impl.Store (Data.Primitive.Types.PrimStorable a)
instance (Data.Store.Impl.Store (Data.Vector.Unboxed.Base.Vector a), Data.Store.Impl.Store (Data.Vector.Unboxed.Base.Vector b), Data.Store.Impl.Store (Data.Vector.Unboxed.Base.Vector c), Data.Store.Impl.Store (Data.Vector.Unboxed.Base.Vector d), Data.Store.Impl.Store (Data.Vector.Unboxed.Base.Vector e), Data.Store.Impl.Store (Data.Vector.Unboxed.Base.Vector f)) => Data.Store.Impl.Store (Data.Vector.Unboxed.Base.Vector (a, b, c, d, e, f))
instance (Data.Store.Impl.Store (Data.Vector.Unboxed.Base.Vector a), Data.Store.Impl.Store (Data.Vector.Unboxed.Base.Vector b), Data.Store.Impl.Store (Data.Vector.Unboxed.Base.Vector c), Data.Store.Impl.Store (Data.Vector.Unboxed.Base.Vector d), Data.Store.Impl.Store (Data.Vector.Unboxed.Base.Vector e)) => Data.Store.Impl.Store (Data.Vector.Unboxed.Base.Vector (a, b, c, d, e))
instance (Data.Store.Impl.Store (Data.Vector.Unboxed.Base.Vector a), Data.Store.Impl.Store (Data.Vector.Unboxed.Base.Vector b), Data.Store.Impl.Store (Data.Vector.Unboxed.Base.Vector c), Data.Store.Impl.Store (Data.Vector.Unboxed.Base.Vector d)) => Data.Store.Impl.Store (Data.Vector.Unboxed.Base.Vector (a, b, c, d))
instance (Data.Store.Impl.Store (Data.Vector.Unboxed.Base.Vector a), Data.Store.Impl.Store (Data.Vector.Unboxed.Base.Vector b), Data.Store.Impl.Store (Data.Vector.Unboxed.Base.Vector c)) => Data.Store.Impl.Store (Data.Vector.Unboxed.Base.Vector (a, b, c))
instance (Data.Store.Impl.Store (Data.Vector.Unboxed.Base.Vector a), Data.Store.Impl.Store (Data.Vector.Unboxed.Base.Vector b)) => Data.Store.Impl.Store (Data.Vector.Unboxed.Base.Vector (a, b))
instance Data.Store.Impl.Store (Data.Vector.Unboxed.Base.Vector a) => Data.Store.Impl.Store (Data.Vector.Unboxed.Base.Vector (Data.Complex.Complex a))
instance Data.Store.Impl.Store (Data.Vector.Unboxed.Base.Vector GHC.Int.Int16)
instance Data.Store.Impl.Store (Data.Vector.Unboxed.Base.Vector GHC.Int.Int32)
instance Data.Store.Impl.Store (Data.Vector.Unboxed.Base.Vector GHC.Int.Int64)
instance Data.Store.Impl.Store (Data.Vector.Unboxed.Base.Vector GHC.Int.Int8)
instance Data.Store.Impl.Store (Data.Vector.Unboxed.Base.Vector GHC.Word.Word16)
instance Data.Store.Impl.Store (Data.Vector.Unboxed.Base.Vector GHC.Word.Word32)
instance Data.Store.Impl.Store (Data.Vector.Unboxed.Base.Vector GHC.Word.Word64)
instance Data.Store.Impl.Store (Data.Vector.Unboxed.Base.Vector GHC.Word.Word8)
instance Data.Store.Impl.Store (Data.Vector.Unboxed.Base.Vector GHC.Types.Bool)
instance Data.Store.Impl.Store (Data.Vector.Unboxed.Base.Vector GHC.Types.Char)
instance Data.Store.Impl.Store (Data.Vector.Unboxed.Base.Vector GHC.Types.Double)
instance Data.Store.Impl.Store (Data.Vector.Unboxed.Base.Vector GHC.Types.Float)
instance Data.Store.Impl.Store (Data.Vector.Unboxed.Base.Vector GHC.Types.Int)
instance Data.Store.Impl.Store (Data.Vector.Unboxed.Base.Vector GHC.Types.Word)
instance Data.Store.Impl.Store (Data.Vector.Unboxed.Base.Vector ())
instance (Data.Store.Impl.Store a, Data.Store.Impl.Store b) => Data.Store.Impl.Store (a, b)
instance (Data.Store.Impl.Store a, Data.Store.Impl.Store b, Data.Store.Impl.Store c) => Data.Store.Impl.Store (a, b, c)
instance (Data.Store.Impl.Store a, Data.Store.Impl.Store b, Data.Store.Impl.Store c, Data.Store.Impl.Store d) => Data.Store.Impl.Store (a, b, c, d)
instance (Data.Store.Impl.Store a, Data.Store.Impl.Store b, Data.Store.Impl.Store c, Data.Store.Impl.Store d, Data.Store.Impl.Store e) => Data.Store.Impl.Store (a, b, c, d, e)
instance (Data.Store.Impl.Store a, Data.Store.Impl.Store b, Data.Store.Impl.Store c, Data.Store.Impl.Store d, Data.Store.Impl.Store e, Data.Store.Impl.Store f) => Data.Store.Impl.Store (a, b, c, d, e, f)
instance (Data.Store.Impl.Store a, Data.Store.Impl.Store b, Data.Store.Impl.Store c, Data.Store.Impl.Store d, Data.Store.Impl.Store e, Data.Store.Impl.Store f, Data.Store.Impl.Store g) => Data.Store.Impl.Store (a, b, c, d, e, f, g)
instance Data.Store.Impl.Store Data.Semigroup.Internal.All
instance Data.Store.Impl.Store Data.Semigroup.Internal.Any
instance Data.Store.Impl.Store Data.Void.Void
instance Data.Store.Impl.Store GHC.Types.Bool
instance (Data.Store.Impl.Store a, Data.Store.Impl.Store b) => Data.Store.Impl.Store (Data.Either.Either a b)
instance GHC.Generics.Generic (Data.Store.Internal.StaticSize n a)
instance (GHC.TypeNats.KnownNat n, Data.Data.Data a) => Data.Data.Data (Data.Store.Internal.StaticSize n a)
instance GHC.Classes.Ord a => GHC.Classes.Ord (Data.Store.Internal.StaticSize n a)
instance GHC.Show.Show a => GHC.Show.Show (Data.Store.Internal.StaticSize n a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (Data.Store.Internal.StaticSize n a)
instance GHC.TypeNats.KnownNat n => Data.Store.Internal.IsStaticSize n Data.ByteString.Internal.ByteString
instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Data.Store.Internal.StaticSize n a)
instance GHC.TypeNats.KnownNat n => Data.Store.Impl.Store (Data.Store.Internal.StaticSize n Data.ByteString.Internal.ByteString)
instance Data.Store.Impl.Store a => Data.Store.Impl.Store (Data.Vector.Vector a)
instance Foreign.Storable.Storable a => Data.Store.Impl.Store (Data.Vector.Storable.Vector a)
instance Data.Store.Impl.Store Data.ByteString.Internal.ByteString
instance Data.Store.Impl.Store Data.ByteString.Short.Internal.ShortByteString
instance Data.Store.Impl.Store Data.ByteString.Lazy.Internal.ByteString
instance Data.Store.Impl.Store Data.Text.Internal.Text
instance Data.Store.Impl.Store a => Data.Store.Impl.Store [a]
instance Data.Store.Impl.Store a => Data.Store.Impl.Store (GHC.Base.NonEmpty a)
instance Data.Store.Impl.Store a => Data.Store.Impl.Store (Data.Sequence.Internal.Seq a)
instance (Data.Store.Impl.Store a, GHC.Classes.Ord a) => Data.Store.Impl.Store (Data.Set.Internal.Set a)
instance Data.Store.Impl.Store Data.IntSet.Internal.IntSet
instance Data.Store.Impl.Store a => Data.Store.Impl.Store (Data.IntMap.Internal.IntMap a)
instance (GHC.Classes.Ord k, Data.Store.Impl.Store k, Data.Store.Impl.Store a) => Data.Store.Impl.Store (Data.Map.Internal.Map k a)
instance (GHC.Classes.Eq k, Data.Hashable.Class.Hashable k, Data.Store.Impl.Store k, Data.Store.Impl.Store a) => Data.Store.Impl.Store (Data.HashMap.Base.HashMap k a)
instance (GHC.Classes.Eq a, Data.Hashable.Class.Hashable a, Data.Store.Impl.Store a) => Data.Store.Impl.Store (Data.HashSet.Base.HashSet a)
instance (GHC.Arr.Ix i, Data.Store.Impl.Store i, Data.Store.Impl.Store e) => Data.Store.Impl.Store (GHC.Arr.Array i e)
instance (GHC.Arr.Ix i, Data.Array.Base.IArray Data.Array.Base.UArray e, Data.Store.Impl.Store i, Data.Store.Impl.Store e) => Data.Store.Impl.Store (Data.Array.Base.UArray i e)
instance Data.Store.Impl.Store GHC.Integer.Type.Integer
instance Data.Store.Impl.Store (Data.Fixed.Fixed a)
instance Data.Store.Impl.Store a => Data.Store.Impl.Store (GHC.Real.Ratio a)
instance Data.Store.Impl.Store Data.Time.Calendar.Days.Day
instance Data.Store.Impl.Store Data.Time.Clock.Internal.DiffTime.DiffTime
instance Data.Store.Impl.Store Data.Time.Clock.Internal.UTCTime.UTCTime
instance Data.Store.Impl.Store ()
instance Data.Store.Impl.Store a => Data.Store.Impl.Store (Data.Semigroup.Internal.Dual a)
instance Data.Store.Impl.Store a => Data.Store.Impl.Store (Data.Semigroup.Internal.Sum a)
instance Data.Store.Impl.Store a => Data.Store.Impl.Store (Data.Semigroup.Internal.Product a)
instance Data.Store.Impl.Store a => Data.Store.Impl.Store (Data.Monoid.First a)
instance Data.Store.Impl.Store a => Data.Store.Impl.Store (Data.Monoid.Last a)
instance Data.Store.Impl.Store a => Data.Store.Impl.Store (GHC.Maybe.Maybe a)

-- | This is the main public API of the store package. The functions
--   exported here are more likely to be stable between versions.
--   
--   Usually you won't need to write your own Store instances, and
--   instead can rely on either using the Generic deriving
--   approach or Data.Store.TH for defining Store instances
--   for your datatypes. There are some tradeoffs here - the generics
--   instances do not require -XTemplateHaskell, but they do not
--   optimize as well for sum types that only require a constant number of
--   bytes.
--   
--   If you need streaming encode / decode of multiple store encoded
--   messages, take a look at the store-streaming package.
module Data.Store

-- | Serializes a value to a ByteString. In order to do this, it
--   first allocates a ByteString of the correct size (based on
--   size), and then uses poke to fill it.
--   
--   Safety of this function depends on correctness of the Store
--   instance. If size returns a. The good news is that this isn't
--   an issue if you use well-tested manual instances (such as those from
--   this package) combined with auomatic definition of instances.
encode :: Store a => a -> ByteString

-- | Decodes a value from a ByteString. Returns an exception if
--   there's an error while decoding, or if decoding undershoots /
--   overshoots the end of the buffer.
decode :: Store a => ByteString -> Either PeekException a

-- | Decodes a value from a ByteString, potentially throwing
--   exceptions, and taking a Peek to run. It is an exception to not
--   consume all input.
decodeWith :: () => Peek a -> ByteString -> Either PeekException a

-- | Decodes a value from a ByteString, potentially throwing
--   exceptions. It is an exception to not consume all input.
decodeEx :: Store a => ByteString -> a

-- | Decodes a value from a ByteString, potentially throwing
--   exceptions, and taking a Peek to run. It is an exception to not
--   consume all input.
decodeExWith :: () => Peek a -> ByteString -> a

-- | Similar to decodeExWith, but it allows there to be more of the
--   buffer remaining. The Offset of the buffer contents immediately
--   after the decoded value is returned.
decodeExPortionWith :: () => Peek a -> ByteString -> (Offset, a)

-- | Decodes a value from a ByteString, potentially throwing
--   exceptions. It is an exception to not consume all input.
decodeIO :: Store a => ByteString -> IO a

-- | Decodes a value from a ByteString, potentially throwing
--   exceptions, and taking a Peek to run. It is an exception to not
--   consume all input.
decodeIOWith :: () => Peek a -> ByteString -> IO a

-- | Similar to decodeExPortionWith, but runs in the IO
--   monad.
decodeIOPortionWith :: () => Peek a -> ByteString -> IO (Offset, a)

-- | The Store typeclass provides efficient serialization and
--   deserialization to raw pointer addresses.
--   
--   The peek and poke methods should be defined such that
--    decodeEx (encode x) == x .
class Store a

-- | Yields the Size of the buffer, in bytes, required to store the
--   encoded representation of the type.
--   
--   Note that the correctness of this function is crucial for the safety
--   of poke, as it does not do any bounds checking. It is the
--   responsibility of the invoker of poke (encode and
--   similar functions) to ensure that there's enough space in the output
--   buffer. If poke writes beyond, then arbitrary memory can be
--   overwritten, causing undefined behavior and segmentation faults.
size :: Store a => Size a

-- | Serializes a value to bytes. It is the responsibility of the caller to
--   ensure that at least the number of bytes required by size are
--   available. These details are handled by encode and similar
--   utilities.
poke :: Store a => a -> Poke ()

-- | Serialized a value from bytes, throwing exceptions if it encounters
--   invalid data or runs out of input bytes.
peek :: Store a => Peek a

-- | Yields the Size of the buffer, in bytes, required to store the
--   encoded representation of the type.
--   
--   Note that the correctness of this function is crucial for the safety
--   of poke, as it does not do any bounds checking. It is the
--   responsibility of the invoker of poke (encode and
--   similar functions) to ensure that there's enough space in the output
--   buffer. If poke writes beyond, then arbitrary memory can be
--   overwritten, causing undefined behavior and segmentation faults.
size :: (Store a, Generic a, GStoreSize (Rep a)) => Size a

-- | Serializes a value to bytes. It is the responsibility of the caller to
--   ensure that at least the number of bytes required by size are
--   available. These details are handled by encode and similar
--   utilities.
poke :: (Store a, Generic a, GStorePoke (Rep a)) => a -> Poke ()

-- | Serialized a value from bytes, throwing exceptions if it encounters
--   invalid data or runs out of input bytes.
peek :: (Store a, Generic a, GStorePeek (Rep a)) => Peek a

-- | Info about a type's serialized length. Either the length is known
--   independently of the value, or the length depends on the value.
data Size a
VarSize :: (a -> Int) -> Size a
ConstSize :: !Int -> Size a

-- | Poke actions are useful for building sequential serializers.
--   
--   They are actions which write values to bytes into memory specified by
--   a Ptr base. The Applicative and Monad instances
--   make it easy to write serializations, by keeping track of the
--   Offset of the current byte. They allow you to chain Poke
--   action such that subsequent Pokes write into subsequent
--   portions of the output.
data Poke a

-- | Peek actions are useful for building sequential deserializers.
--   
--   They are actions which read from memory and construct values from it.
--   The Applicative and Monad instances make it easy to
--   chain these together to get more complicated deserializers. This
--   machinery keeps track of the current Ptr and end-of-buffer
--   Ptr.
data Peek a
class GStoreSize f
class GStorePoke f
class GStorePeek f

-- | Exception thrown while running peek. Note that other types of
--   exceptions can also be thrown. Invocations of fail in the
--   Poke monad causes this exception to be thrown.
--   
--   PeekException is thrown when the data being decoded is invalid.
data PeekException
PeekException :: Offset -> Text -> PeekException
[peekExBytesFromEnd] :: PeekException -> Offset
[peekExMessage] :: PeekException -> Text

-- | Throws a PeekException.
peekException :: () => Text -> Peek a

module Data.Store.TypeHash.Internal
newtype Tagged a
Tagged :: a -> Tagged a
[unTagged] :: Tagged a -> a
newtype TypeHash
TypeHash :: StaticSize 20 ByteString -> TypeHash
[unTypeHash] :: TypeHash -> StaticSize 20 ByteString
reifyManyTyDecls :: ((Name, Info) -> Q (Bool, [Name])) -> [Name] -> Q [(Name, Info)]

-- | At compiletime, this yields a hash of the specified datatypes. Not
--   only does this cover the datatypes themselves, but also all transitive
--   dependencies.
--   
--   The resulting expression is a literal of type TypeHash.
typeHashForNames :: [Name] -> Q Exp

-- | At compiletime, this yields a cryptographic hash of the specified
--   Type, including the definition of things it references
--   (transitively).
--   
--   The resulting expression is a literal of type TypeHash.
hashOfType :: Type -> Q Exp
getTypeInfosRecursively :: [Name] -> Q [(Name, Info)]
getConNames :: Data a => a -> [Name]
getVarNames :: Data a => a -> [Name]
class HasTypeHash a
typeHash :: HasTypeHash a => Proxy a -> TypeHash

-- | Deprecated: Use of Data.Store.TypeHash isn't recommended, as the
--   hashes are too unstable for most uses. Please instead consider using
--   Data.Store.Version. See
--   https://github.com/fpco/store/issues/53
mkHasTypeHash :: Type -> Q [Dec]

-- | Deprecated: Use of Data.Store.TypeHash isn't recommended, as the
--   hashes are too unstable for most uses. Please instead consider using
--   Data.Store.Version. See
--   https://github.com/fpco/store/issues/53
mkManyHasTypeHash :: [Q Type] -> Q [Dec]
combineTypeHashes :: [TypeHash] -> TypeHash
instance GHC.Generics.Generic Data.Store.TypeHash.Internal.TypeHash
instance Data.Store.Impl.Store Data.Store.TypeHash.Internal.TypeHash
instance GHC.Show.Show Data.Store.TypeHash.Internal.TypeHash
instance GHC.Classes.Ord Data.Store.TypeHash.Internal.TypeHash
instance GHC.Classes.Eq Data.Store.TypeHash.Internal.TypeHash
instance GHC.Generics.Generic (Data.Store.TypeHash.Internal.Tagged a)
instance Data.Data.Data a => Data.Data.Data (Data.Store.TypeHash.Internal.Tagged a)
instance GHC.Show.Show a => GHC.Show.Show (Data.Store.TypeHash.Internal.Tagged a)
instance GHC.Classes.Ord a => GHC.Classes.Ord (Data.Store.TypeHash.Internal.Tagged a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (Data.Store.TypeHash.Internal.Tagged a)
instance Data.Data.Data Data.Store.TypeHash.Internal.TypeHash
instance (Data.Store.Impl.Store a, Data.Store.TypeHash.Internal.HasTypeHash a) => Data.Store.Impl.Store (Data.Store.TypeHash.Internal.Tagged a)
instance Control.DeepSeq.NFData Data.Store.TypeHash.Internal.TypeHash
instance Language.Haskell.TH.Syntax.Lift Data.Store.TypeHash.Internal.TypeHash
instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Data.Store.TypeHash.Internal.Tagged a)

module Data.Store.TypeHash
newtype Tagged a
Tagged :: a -> Tagged a
[unTagged] :: Tagged a -> a
data TypeHash
class HasTypeHash a
typeHash :: HasTypeHash a => Proxy a -> TypeHash

-- | Deprecated: Use of Data.Store.TypeHash isn't recommended, as the
--   hashes are too unstable for most uses. Please instead consider using
--   Data.Store.Version. See
--   https://github.com/fpco/store/issues/53
mkHasTypeHash :: Type -> Q [Dec]

-- | Deprecated: Use of Data.Store.TypeHash isn't recommended, as the
--   hashes are too unstable for most uses. Please instead consider using
--   Data.Store.Version. See
--   https://github.com/fpco/store/issues/53
mkManyHasTypeHash :: [Q Type] -> Q [Dec]

-- | This module provides utilities which help ensure that we aren't
--   attempting to de-serialize data that is an older or newer version. The
--   WithVersion utility wraps up a datatype along with a version
--   tag. This version tag can either be provided by the user
--   (namedVersionConfig), or use a computed hash
--   (hashedVersionConfig).
--   
--   The magic here is using an SYB traversal (Data) to get the
--   structure of all the data-types involved. This info is rendered to
--   text and hashed to yield a hash which describes it.
--   
--   NOTE that this API is still quite new and so is likely to break
--   compatibility in the future. It should also be expected that the
--   computed hashes may change between major version bumps, though this
--   will be minimized when directly feasible.
module Data.Store.Version
newtype StoreVersion
StoreVersion :: ByteString -> StoreVersion
[unStoreVersion] :: StoreVersion -> ByteString

-- | Configuration for the version checking of a particular type.
data VersionConfig a
VersionConfig :: Maybe String -> Maybe String -> Set String -> Map String String -> VersionConfig a

-- | When set, specifies the hash which is expected to be computed.
[vcExpectedHash] :: VersionConfig a -> Maybe String

-- | When set, specifies the name to instead use to tag the data.
[vcManualName] :: VersionConfig a -> Maybe String

-- | DataTypes to ignore.
[vcIgnore] :: VersionConfig a -> Set String

-- | Allowed renamings of datatypes, useful when they move.
[vcRenames] :: VersionConfig a -> Map String String
hashedVersionConfig :: String -> VersionConfig a
namedVersionConfig :: String -> String -> VersionConfig a
encodeWithVersionQ :: Data a => VersionConfig a -> Q Exp
decodeWithVersionQ :: Data a => VersionConfig a -> Q Exp
instance GHC.Generics.Generic (Data.Store.Version.VersionConfig a)
instance Data.Data.Data a => Data.Data.Data (Data.Store.Version.VersionConfig a)
instance GHC.Show.Show (Data.Store.Version.VersionConfig a)
instance GHC.Classes.Eq (Data.Store.Version.VersionConfig a)
instance Data.Store.Impl.Store Data.Store.Version.StoreVersion
instance GHC.Generics.Generic Data.Store.Version.StoreVersion
instance Data.Data.Data Data.Store.Version.StoreVersion
instance GHC.Classes.Ord Data.Store.Version.StoreVersion
instance GHC.Show.Show Data.Store.Version.StoreVersion
instance GHC.Classes.Eq Data.Store.Version.StoreVersion

-- | A ByteBuffer is a simple buffer for bytes. It supports two
--   operations: refilling with the contents of a ByteString, and
--   consuming a fixed number of bytes.
--   
--   It is implemented as a pointer, together with counters that keep track
--   of the offset and the number of bytes in the buffer. Note that the
--   counters are simple IORefs, so ByteBuffers are not
--   thread-safe!
--   
--   A ByteBuffer is constructed by new with a given starting
--   length, and will grow (by repeatedly multiplying its size by 1.5)
--   whenever it is being fed a ByteString that is too large.
module System.IO.ByteBuffer
type ByteBuffer = IORef (Either ByteBufferException BBRef)

-- | Allocates a new ByteBuffer with a given buffer size filling from the
--   given FillBuffer.
--   
--   Note that ByteBuffers created with new have to be
--   deallocated explicitly using free. For automatic deallocation,
--   consider using with instead.
new :: MonadIO m => Maybe Int -> m ByteBuffer

-- | Free a byte buffer.
free :: MonadIO m => ByteBuffer -> m ()

-- | Perform some action with a bytebuffer, with automatic allocation and
--   deallocation.
with :: (MonadIO m, MonadBaseControl IO m) => Maybe Int -> (ByteBuffer -> m a) -> m a
totalSize :: MonadIO m => ByteBuffer -> m Int
isEmpty :: MonadIO m => ByteBuffer -> m Bool

-- | Number of available bytes in a ByteBuffer (that is, bytes that
--   have been copied to, but not yet read from the ByteBuffer.
availableBytes :: MonadIO m => ByteBuffer -> m Int

-- | Copy the contents of a ByteString to a ByteBuffer.
--   
--   If necessary, the ByteBuffer is enlarged and/or already
--   consumed bytes are dropped.
copyByteString :: MonadIO m => ByteBuffer -> ByteString -> m ()

-- | Will read at most n bytes from the given Fd, in a non-blocking
--   fashion. This function is intended to be used with non-blocking
--   Sockets, such the ones created by the network
--   package.
--   
--   Returns how many bytes could be read non-blockingly.
fillFromFd :: MonadIO m => ByteBuffer -> Fd -> Int -> m Int

-- | As unsafeConsume, but instead of returning a Ptr into
--   the contents of the ByteBuffer, it returns a ByteString
--   containing the next n bytes in the buffer. This involves
--   allocating a new ByteString and copying the n bytes to
--   it.
consume :: MonadIO m => ByteBuffer -> Int -> m (Either Int ByteString)

-- | Try to get a pointer to n bytes from the ByteBuffer.
--   
--   Note that the pointer should be used before any other actions are
--   performed on the ByteBuffer. It points to some address within
--   the buffer, so operations such as enlarging the buffer or feeding it
--   new data will change the data the pointer points to. This is why this
--   function is called unsafe.
unsafeConsume :: MonadIO m => ByteBuffer -> Int -> m (Either Int (Ptr Word8))

-- | Exception that is thrown when an invalid ByteBuffer is being
--   used that is no longer valid.
--   
--   A ByteBuffer is considered to be invalid if
--   
--   
--   
- it has explicitly been freed
--   
- an Exception has occured during an operation that modified it
--   
data ByteBufferException
ByteBufferException :: !String -> !String -> ByteBufferException

-- | function name that caused the exception
[_bbeLocation] :: ByteBufferException -> !String

-- | printed representation of the exception
[_bbeException] :: ByteBufferException -> !String
instance GHC.Classes.Eq System.IO.ByteBuffer.ByteBufferException
instance GHC.Show.Show System.IO.ByteBuffer.ByteBufferException
instance GHC.Exception.Type.Exception System.IO.ByteBuffer.ByteBufferException
