Data.Hashable.Generic

hashable-1.5.0.0: A class for types that can be converted to a hash value

License | BSD-3-Clause
Stability | provisional
Portability | GHC >= 7.4
Safe Haskell | Safe
Language | Haskell2010

Data.Hashable.Generic

Contents

- Implementation using Generics.
- Constraints

Description

Hashable support for GHC generics.

Since: 1.3.0.0

Synopsis

- genericHashWithSalt :: (Generic a, GHashable Zero (Rep a)) => Int -> a -> Int
- genericLiftHashWithSalt :: (Generic1 t, GHashable One (Rep1 t)) => (Int -> a -> Int) -> Int -> t a -> Int
- class GHashable arity (f :: Type -> Type) where
  - ghashWithSalt :: HashArgs arity a -> Int -> f a -> Int
- data One
- data Zero
- data family HashArgs arity a

# Implementation using Generics.

genericHashWithSalt :: (Generic a, GHashable Zero (Rep a)) => Int -> a -> Int #

Generic `hashWithSalt`.

Since: 1.3.0.0

genericLiftHashWithSalt :: (Generic1 t, GHashable One (Rep1 t)) => (Int -> a -> Int) -> Int -> t a -> Int #

Generic `liftHashWithSalt`.

Since: 1.3.0.0

# Constraints

class GHashable arity (f :: Type -> Type) where #

The class of types that can be generically hashed.

Methods

ghashWithSalt :: HashArgs arity a -> Int -> f a -> Int #

#### Instances

Instances details

GHashable One Par1 # |
Instance details Defined in Data.Hashable.Generic.Instances Methods ghashWithSalt :: HashArgs One a -> Int -> Par1 a -> Int #
GHashable arity (U1 :: Type -> Type) # |
Instance details Defined in Data.Hashable.Generic.Instances Methods ghashWithSalt :: HashArgs arity a -> Int -> U1 a -> Int #
GHashable arity (V1 :: Type -> Type) # |
Instance details Defined in Data.Hashable.Generic.Instances Methods ghashWithSalt :: HashArgs arity a -> Int -> V1 a -> Int #
Hashable1 f => GHashable One (Rec1 f) # |
Instance details Defined in Data.Hashable.Generic.Instances Methods ghashWithSalt :: HashArgs One a -> Int -> Rec1 f a -> Int #
(GHashable arity a, GHashable arity b) => GHashable arity (a :*: b) # |
Instance details Defined in Data.Hashable.Generic.Instances Methods ghashWithSalt :: HashArgs arity a0 -> Int -> (a :*: b) a0 -> Int #
(GSum arity a, GSum arity b) => GHashable arity (a :+: b) # |
Instance details Defined in Data.Hashable.Generic.Instances Methods ghashWithSalt :: HashArgs arity a0 -> Int -> (a :+: b) a0 -> Int #
Hashable a => GHashable arity (K1 i a :: Type -> Type) # |
Instance details Defined in Data.Hashable.Generic.Instances Methods ghashWithSalt :: HashArgs arity a0 -> Int -> K1 i a a0 -> Int #
(Hashable1 f, GHashable One g) => GHashable One (f :.: g) # |
Instance details Defined in Data.Hashable.Generic.Instances Methods ghashWithSalt :: HashArgs One a -> Int -> (f :.: g) a -> Int #
GHashable arity a => GHashable arity (M1 i c a) # |
Instance details Defined in Data.Hashable.Generic.Instances Methods ghashWithSalt :: HashArgs arity a0 -> Int -> M1 i c a a0 -> Int #

data One #

#### Instances

Instances details

GHashable One Par1 # |
Instance details Defined in Data.Hashable.Generic.Instances Methods ghashWithSalt :: HashArgs One a -> Int -> Par1 a -> Int #
Hashable1 f => GHashable One (Rec1 f) # |
Instance details Defined in Data.Hashable.Generic.Instances Methods ghashWithSalt :: HashArgs One a -> Int -> Rec1 f a -> Int #
(Hashable1 f, GHashable One g) => GHashable One (f :.: g) # |
Instance details Defined in Data.Hashable.Generic.Instances Methods ghashWithSalt :: HashArgs One a -> Int -> (f :.: g) a -> Int #
newtype HashArgs One a # |
Instance details Defined in Data.Hashable.Class newtype HashArgs One a = HashArgs1 (Int -> a -> Int)

data Zero #

#### Instances

Instances details

data HashArgs Zero a # |
Instance details Defined in Data.Hashable.Class data HashArgs Zero a = HashArgs0

data family HashArgs arity a #

#### Instances

Instances details

newtype HashArgs One a # |
Instance details Defined in Data.Hashable.Class newtype HashArgs One a = HashArgs1 (Int -> a -> Int)
data HashArgs Zero a # |
Instance details Defined in Data.Hashable.Class data HashArgs Zero a = HashArgs0