hashable-accelerate-0.1.0.0: A class for types which can be converted into a hash value

Copyright[2020] Trevor L. McDonell
LicenseBSD3
MaintainerTrevor L. McDonell <trevor.mcdonell@gmail.com>
Stabilityexperimental
Portabilitynon-portable (GHC extensions)
Safe HaskellNone
LanguageHaskell2010

Data.Array.Accelerate.Data.Hashable

Description

This module defines a class Hashable, for types that can be converted to a hash value.

Synopsis

Documentation

class Elt a => Hashable a where Source #

The class of types that can be converted to a hash value.

Minimal complete definition

hashWithSalt

Methods

hashWithSalt :: Exp Int -> Exp a -> Exp Int infixl 0 Source #

Return a hash value for the argument, using the given salt.

The general contract of hashWithSalt is:

  • If two values are equal according to the == method, then applying the hashWithSalt method on each of the two values must produce the same integer result if the same salt is used in each case.
  • It is not required that if two values are unequal according to the == method, then applying the hashWithSalt method on each of the two values must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal values may improve the performance of hashing-based data structures.
  • This method can be used to compute different hash values for the same input by providing a different salt in each application of the method. This implies that any instance that defines hashWithSalt must make use of the salt in its implementation.

hash :: Exp a -> Exp Int Source #

Like hashWithSalt, but no salt is used. The default implementation uses hashWithSalt with some default salt. Instances might want to implement this method to provide a more efficient implementation than the default implementation.

Instances
Hashable Bool Source # 
Instance details

Defined in Data.Array.Accelerate.Data.Hashable

Hashable Char Source # 
Instance details

Defined in Data.Array.Accelerate.Data.Hashable

Hashable Double Source # 
Instance details

Defined in Data.Array.Accelerate.Data.Hashable

Hashable Float Source # 
Instance details

Defined in Data.Array.Accelerate.Data.Hashable

Hashable Int Source # 
Instance details

Defined in Data.Array.Accelerate.Data.Hashable

Hashable Int8 Source # 
Instance details

Defined in Data.Array.Accelerate.Data.Hashable

Hashable Int16 Source # 
Instance details

Defined in Data.Array.Accelerate.Data.Hashable

Hashable Int32 Source # 
Instance details

Defined in Data.Array.Accelerate.Data.Hashable

Hashable Int64 Source # 
Instance details

Defined in Data.Array.Accelerate.Data.Hashable

Hashable Word Source # 
Instance details

Defined in Data.Array.Accelerate.Data.Hashable

Hashable Word8 Source # 
Instance details

Defined in Data.Array.Accelerate.Data.Hashable

Hashable Word16 Source # 
Instance details

Defined in Data.Array.Accelerate.Data.Hashable

Hashable Word32 Source # 
Instance details

Defined in Data.Array.Accelerate.Data.Hashable

Hashable Word64 Source # 
Instance details

Defined in Data.Array.Accelerate.Data.Hashable

Hashable () Source # 
Instance details

Defined in Data.Array.Accelerate.Data.Hashable

Methods

hashWithSalt :: Exp Int -> Exp () -> Exp Int Source #

hash :: Exp () -> Exp Int Source #

Hashable Half Source # 
Instance details

Defined in Data.Array.Accelerate.Data.Hashable

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

Defined in Data.Array.Accelerate.Data.Hashable

Methods

hashWithSalt :: Exp Int -> Exp (Maybe a) -> Exp Int Source #

hash :: Exp (Maybe a) -> Exp Int Source #

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

Defined in Data.Array.Accelerate.Data.Hashable

Methods

hashWithSalt :: Exp Int -> Exp (Ratio a) -> Exp Int Source #

hash :: Exp (Ratio a) -> Exp Int Source #

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

Defined in Data.Array.Accelerate.Data.Hashable

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

Defined in Data.Array.Accelerate.Data.Hashable

Methods

hashWithSalt :: Exp Int -> Exp (Sum a) -> Exp Int Source #

hash :: Exp (Sum a) -> Exp Int Source #

Hashable a => Hashable (Max a) Source # 
Instance details

Defined in Data.Array.Accelerate.Data.Hashable

Methods

hashWithSalt :: Exp Int -> Exp (Max a) -> Exp Int Source #

hash :: Exp (Max a) -> Exp Int Source #

Hashable a => Hashable (Min a) Source # 
Instance details

Defined in Data.Array.Accelerate.Data.Hashable

Methods

hashWithSalt :: Exp Int -> Exp (Min a) -> Exp Int Source #

hash :: Exp (Min a) -> Exp Int Source #

Hashable a => Hashable (Complex a) Source # 
Instance details

Defined in Data.Array.Accelerate.Data.Hashable

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

Defined in Data.Array.Accelerate.Data.Hashable

Methods

hashWithSalt :: Exp Int -> Exp (Either a b) -> Exp Int Source #

hash :: Exp (Either a b) -> Exp Int Source #

(Hashable x0, Hashable x1) => Hashable (x0, x1) Source # 
Instance details

Defined in Data.Array.Accelerate.Data.Hashable

Methods

hashWithSalt :: Exp Int -> Exp (x0, x1) -> Exp Int Source #

hash :: Exp (x0, x1) -> Exp Int Source #

(Hashable x0, Hashable x1, Hashable x2) => Hashable (x0, x1, x2) Source # 
Instance details

Defined in Data.Array.Accelerate.Data.Hashable

Methods

hashWithSalt :: Exp Int -> Exp (x0, x1, x2) -> Exp Int Source #

hash :: Exp (x0, x1, x2) -> Exp Int Source #

(Hashable x0, Hashable x1, Hashable x2, Hashable x3) => Hashable (x0, x1, x2, x3) Source # 
Instance details

Defined in Data.Array.Accelerate.Data.Hashable

Methods

hashWithSalt :: Exp Int -> Exp (x0, x1, x2, x3) -> Exp Int Source #

hash :: Exp (x0, x1, x2, x3) -> Exp Int Source #

(Hashable x0, Hashable x1, Hashable x2, Hashable x3, Hashable x4) => Hashable (x0, x1, x2, x3, x4) Source # 
Instance details

Defined in Data.Array.Accelerate.Data.Hashable

Methods

hashWithSalt :: Exp Int -> Exp (x0, x1, x2, x3, x4) -> Exp Int Source #

hash :: Exp (x0, x1, x2, x3, x4) -> Exp Int Source #

(Hashable x0, Hashable x1, Hashable x2, Hashable x3, Hashable x4, Hashable x5) => Hashable (x0, x1, x2, x3, x4, x5) Source # 
Instance details

Defined in Data.Array.Accelerate.Data.Hashable

Methods

hashWithSalt :: Exp Int -> Exp (x0, x1, x2, x3, x4, x5) -> Exp Int Source #

hash :: Exp (x0, x1, x2, x3, x4, x5) -> Exp Int Source #

(Hashable x0, Hashable x1, Hashable x2, Hashable x3, Hashable x4, Hashable x5, Hashable x6) => Hashable (x0, x1, x2, x3, x4, x5, x6) Source # 
Instance details

Defined in Data.Array.Accelerate.Data.Hashable

Methods

hashWithSalt :: Exp Int -> Exp (x0, x1, x2, x3, x4, x5, x6) -> Exp Int Source #

hash :: Exp (x0, x1, x2, x3, x4, x5, x6) -> Exp Int Source #

(Hashable x0, Hashable x1, Hashable x2, Hashable x3, Hashable x4, Hashable x5, Hashable x6, Hashable x7) => Hashable (x0, x1, x2, x3, x4, x5, x6, x7) Source # 
Instance details

Defined in Data.Array.Accelerate.Data.Hashable

Methods

hashWithSalt :: Exp Int -> Exp (x0, x1, x2, x3, x4, x5, x6, x7) -> Exp Int Source #

hash :: Exp (x0, x1, x2, x3, x4, x5, x6, x7) -> Exp Int Source #

(Hashable x0, Hashable x1, Hashable x2, Hashable x3, Hashable x4, Hashable x5, Hashable x6, Hashable x7, Hashable x8) => Hashable (x0, x1, x2, x3, x4, x5, x6, x7, x8) Source # 
Instance details

Defined in Data.Array.Accelerate.Data.Hashable

Methods

hashWithSalt :: Exp Int -> Exp (x0, x1, x2, x3, x4, x5, x6, x7, x8) -> Exp Int Source #

hash :: Exp (x0, x1, x2, x3, x4, x5, x6, x7, x8) -> Exp Int Source #

(Hashable x0, Hashable x1, Hashable x2, Hashable x3, Hashable x4, Hashable x5, Hashable x6, Hashable x7, Hashable x8, Hashable x9) => Hashable (x0, x1, x2, x3, x4, x5, x6, x7, x8, x9) Source # 
Instance details

Defined in Data.Array.Accelerate.Data.Hashable

Methods

hashWithSalt :: Exp Int -> Exp (x0, x1, x2, x3, x4, x5, x6, x7, x8, x9) -> Exp Int Source #

hash :: Exp (x0, x1, x2, x3, x4, x5, x6, x7, x8, x9) -> Exp Int Source #

(Hashable x0, Hashable x1, Hashable x2, Hashable x3, Hashable x4, Hashable x5, Hashable x6, Hashable x7, Hashable x8, Hashable x9, Hashable x10) => Hashable (x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10) Source # 
Instance details

Defined in Data.Array.Accelerate.Data.Hashable

Methods

hashWithSalt :: Exp Int -> Exp (x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10) -> Exp Int Source #

hash :: Exp (x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10) -> Exp Int Source #

(Hashable x0, Hashable x1, Hashable x2, Hashable x3, Hashable x4, Hashable x5, Hashable x6, Hashable x7, Hashable x8, Hashable x9, Hashable x10, Hashable x11) => Hashable (x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11) Source # 
Instance details

Defined in Data.Array.Accelerate.Data.Hashable

Methods

hashWithSalt :: Exp Int -> Exp (x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11) -> Exp Int Source #

hash :: Exp (x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11) -> Exp Int Source #

(Hashable x0, Hashable x1, Hashable x2, Hashable x3, Hashable x4, Hashable x5, Hashable x6, Hashable x7, Hashable x8, Hashable x9, Hashable x10, Hashable x11, Hashable x12) => Hashable (x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12) Source # 
Instance details

Defined in Data.Array.Accelerate.Data.Hashable

Methods

hashWithSalt :: Exp Int -> Exp (x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12) -> Exp Int Source #

hash :: Exp (x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12) -> Exp Int Source #

(Hashable x0, Hashable x1, Hashable x2, Hashable x3, Hashable x4, Hashable x5, Hashable x6, Hashable x7, Hashable x8, Hashable x9, Hashable x10, Hashable x11, Hashable x12, Hashable x13) => Hashable (x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13) Source # 
Instance details

Defined in Data.Array.Accelerate.Data.Hashable

Methods

hashWithSalt :: Exp Int -> Exp (x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13) -> Exp Int Source #

hash :: Exp (x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13) -> Exp Int Source #

(Hashable x0, Hashable x1, Hashable x2, Hashable x3, Hashable x4, Hashable x5, Hashable x6, Hashable x7, Hashable x8, Hashable x9, Hashable x10, Hashable x11, Hashable x12, Hashable x13, Hashable x14) => Hashable (x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14) Source # 
Instance details

Defined in Data.Array.Accelerate.Data.Hashable

Methods

hashWithSalt :: Exp Int -> Exp (x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14) -> Exp Int Source #

hash :: Exp (x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14) -> Exp Int Source #

(Hashable x0, Hashable x1, Hashable x2, Hashable x3, Hashable x4, Hashable x5, Hashable x6, Hashable x7, Hashable x8, Hashable x9, Hashable x10, Hashable x11, Hashable x12, Hashable x13, Hashable x14, Hashable x15) => Hashable (x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15) Source # 
Instance details

Defined in Data.Array.Accelerate.Data.Hashable

Methods

hashWithSalt :: Exp Int -> Exp (x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15) -> Exp Int Source #

hash :: Exp (x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15) -> Exp Int Source #

hashUsing Source #

Arguments

:: Hashable b 
=> (Exp a -> Exp b)

transformation function

-> Exp Int

salt

-> Exp a

value to transform

-> Exp Int 

Transform a value into a Hashable value, then hash the transformed value using the given salt.

This is a useful shorthand in cases where a type can easily be mapped to another type that is already an instance of Hashable.