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

Generic `hashWithSalt`.

Since: 1.3.0.0

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

Generic `liftHashWithSalt`.

Since: 1.3.0.0

# Constraints

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

The class of types that can be generically hashed.

Methods

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

#### Instances

Instances details

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

data One Source #

#### Instances

Instances details

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

data Zero Source #

#### Instances

Instances details

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

data family HashArgs arity a Source #

#### Instances

Instances details

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