Derive a Data instance for Digest.
This commit is contained in:
parent
4622e5fc8e
commit
8a61d8e5e2
@ -8,6 +8,7 @@
|
|||||||
-- Crypto hash types definitions
|
-- Crypto hash types definitions
|
||||||
--
|
--
|
||||||
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
|
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
|
||||||
|
{-# LANGUAGE DeriveDataTypeable #-}
|
||||||
{-# LANGUAGE DataKinds #-}
|
{-# LANGUAGE DataKinds #-}
|
||||||
{-# LANGUAGE ScopedTypeVariables #-}
|
{-# LANGUAGE ScopedTypeVariables #-}
|
||||||
{-# LANGUAGE TypeFamilies #-}
|
{-# LANGUAGE TypeFamilies #-}
|
||||||
@ -28,6 +29,7 @@ import Basement.Block.Mutable (MutableBlock, new, unsafeWrite)
|
|||||||
import Basement.NormalForm (deepseq)
|
import Basement.NormalForm (deepseq)
|
||||||
import Basement.Types.OffsetSize (CountOf(..), Offset(..))
|
import Basement.Types.OffsetSize (CountOf(..), Offset(..))
|
||||||
import GHC.TypeLits (Nat)
|
import GHC.TypeLits (Nat)
|
||||||
|
import Data.Data (Data)
|
||||||
|
|
||||||
-- | Class representing hashing algorithms.
|
-- | Class representing hashing algorithms.
|
||||||
--
|
--
|
||||||
@ -76,7 +78,7 @@ newtype Context a = Context Bytes
|
|||||||
-- Creating a digest from a bytearray is also possible with function
|
-- Creating a digest from a bytearray is also possible with function
|
||||||
-- 'Crypto.Hash.digestFromByteString'.
|
-- 'Crypto.Hash.digestFromByteString'.
|
||||||
newtype Digest a = Digest (Block Word8)
|
newtype Digest a = Digest (Block Word8)
|
||||||
deriving (Eq,Ord,ByteArrayAccess)
|
deriving (Eq,Ord,ByteArrayAccess, Data)
|
||||||
|
|
||||||
instance NFData (Digest a) where
|
instance NFData (Digest a) where
|
||||||
rnf (Digest u) = u `deepseq` ()
|
rnf (Digest u) = u `deepseq` ()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user