Data.Store.TypeHash.Internal

store-0.4.2: Fast binary serialization

Safe Haskell | None
Language | Haskell2010

Data.Store.TypeHash.Internal

Synopsis

- newtype Tagged a = Tagged {
  - unTagged :: a
  }
- newtype TypeHash = TypeHash {
  - unTypeHash :: StaticSize 20 ByteString
  }
- reifyManyTyDecls :: ((Name, Info) -> Q (Bool, [Name])) -> [Name] -> Q [(Name, Info)]
- typeHashForNames :: [Name] -> Q Exp
- hashOfType :: Type -> Q Exp
- getTypeInfosRecursively :: [Name] -> Q [(Name, Info)]
- getConNames :: Data a => a -> [Name]
- getVarNames :: Data a => a -> [Name]
- class HasTypeHash a where
- mkHasTypeHash :: Type -> Q [Dec]
- mkManyHasTypeHash :: [Q Type] -> Q [Dec]
- combineTypeHashes :: [TypeHash] -> TypeHash

# Documentation

newtype Tagged a #

Constructors

Tagged |
Fields unTagged :: a

Instances

Eq a => Eq (Tagged a) # |
Methods (==) :: Tagged a -> Tagged a -> Bool # (/=) :: Tagged a -> Tagged a -> Bool #
Data a => Data (Tagged a) # |
Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Tagged a -> c (Tagged a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Tagged a) # toConstr :: Tagged a -> Constr # dataTypeOf :: Tagged a -> DataType # dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c (Tagged a)) # dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Tagged a)) # gmapT :: (forall b. Data b => b -> b) -> Tagged a -> Tagged a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Tagged a -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Tagged a -> r # gmapQ :: (forall d. Data d => d -> u) -> Tagged a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Tagged a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Tagged a -> m (Tagged a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Tagged a -> m (Tagged a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Tagged a -> m (Tagged a) #
Ord a => Ord (Tagged a) # |
Methods compare :: Tagged a -> Tagged a -> Ordering # (<) :: Tagged a -> Tagged a -> Bool # (<=) :: Tagged a -> Tagged a -> Bool # (>) :: Tagged a -> Tagged a -> Bool # (>=) :: Tagged a -> Tagged a -> Bool # max :: Tagged a -> Tagged a -> Tagged a # min :: Tagged a -> Tagged a -> Tagged a #
Show a => Show (Tagged a) # |
Methods showsPrec :: Int -> Tagged a -> ShowS # show :: Tagged a -> String # showList :: [Tagged a] -> ShowS #
Generic (Tagged a) # |
Associated Types type Rep (Tagged a) :: * -> * # Methods from :: Tagged a -> Rep (Tagged a) x # to :: Rep (Tagged a) x -> Tagged a #
NFData a => NFData (Tagged a) # |
Methods rnf :: Tagged a -> () #
(Store a, HasTypeHash a) => Store (Tagged a) # |
Methods size :: Size (Tagged a) # poke :: Tagged a -> Poke () # peek :: Peek (Tagged a) #
type Rep (Tagged a) # |
type Rep (Tagged a) = D1 (MetaData "Tagged" "Data.Store.TypeHash.Internal" "store-0.4.2-IL2R1MUHBlBCU522p0eJJv" True) (C1 (MetaCons "Tagged" PrefixI True) (S1 (MetaSel (Just Symbol "unTagged") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a)))

newtype TypeHash #

Constructors

TypeHash |
Fields unTypeHash :: StaticSize 20 ByteString

Instances

Eq TypeHash # |
Methods (==) :: TypeHash -> TypeHash -> Bool # (/=) :: TypeHash -> TypeHash -> Bool #
Data TypeHash # |
Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> TypeHash -> c TypeHash # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c TypeHash # toConstr :: TypeHash -> Constr # dataTypeOf :: TypeHash -> DataType # dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c TypeHash) # dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TypeHash) # gmapT :: (forall b. Data b => b -> b) -> TypeHash -> TypeHash # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TypeHash -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TypeHash -> r # gmapQ :: (forall d. Data d => d -> u) -> TypeHash -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> TypeHash -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> TypeHash -> m TypeHash # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> TypeHash -> m TypeHash # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> TypeHash -> m TypeHash #
Ord TypeHash # |
Methods compare :: TypeHash -> TypeHash -> Ordering # (<) :: TypeHash -> TypeHash -> Bool # (<=) :: TypeHash -> TypeHash -> Bool # (>) :: TypeHash -> TypeHash -> Bool # (>=) :: TypeHash -> TypeHash -> Bool # max :: TypeHash -> TypeHash -> TypeHash # min :: TypeHash -> TypeHash -> TypeHash #
Show TypeHash # |
Methods showsPrec :: Int -> TypeHash -> ShowS # show :: TypeHash -> String # showList :: [TypeHash] -> ShowS #
Generic TypeHash # |
Associated Types type Rep TypeHash :: * -> * # Methods from :: TypeHash -> Rep TypeHash x # to :: Rep TypeHash x -> TypeHash #
Lift TypeHash # |
Methods lift :: TypeHash -> Q Exp #
NFData TypeHash # |
Methods rnf :: TypeHash -> () #
Store TypeHash # |
Methods size :: Size TypeHash # poke :: TypeHash -> Poke () # peek :: Peek TypeHash #
type Rep TypeHash # |
type Rep TypeHash = D1 (MetaData "TypeHash" "Data.Store.TypeHash.Internal" "store-0.4.2-IL2R1MUHBlBCU522p0eJJv" True) (C1 (MetaCons "TypeHash" PrefixI True) (S1 (MetaSel (Just Symbol "unTypeHash") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (StaticSize 20 ByteString))))

reifyManyTyDecls :: ((Name, Info) -> Q (Bool, [Name])) -> [Name] -> Q [(Name, Info)] #

typeHashForNames :: [Name] -> Q Exp #

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`.

hashOfType :: Type -> 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`.

getTypeInfosRecursively :: [Name] -> Q [(Name, Info)] #

getConNames :: Data a => a -> [Name] #

getVarNames :: Data a => a -> [Name] #

class HasTypeHash a where #

Minimal complete definition

typeHash

Methods

typeHash :: Proxy a -> TypeHash #

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] #

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

combineTypeHashes :: [TypeHash] -> TypeHash #