From 8a61d8e5e27f7100c7579f251d0efb5a3711d58d Mon Sep 17 00:00:00 2001 From: Leif Warner Date: Mon, 18 Jun 2018 00:20:48 -0700 Subject: [PATCH] Derive a Data instance for Digest. --- Crypto/Hash/Types.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Crypto/Hash/Types.hs b/Crypto/Hash/Types.hs index c537ada..65a3b61 100644 --- a/Crypto/Hash/Types.hs +++ b/Crypto/Hash/Types.hs @@ -8,6 +8,7 @@ -- Crypto hash types definitions -- {-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeFamilies #-} @@ -28,6 +29,7 @@ import Basement.Block.Mutable (MutableBlock, new, unsafeWrite) import Basement.NormalForm (deepseq) import Basement.Types.OffsetSize (CountOf(..), Offset(..)) import GHC.TypeLits (Nat) +import Data.Data (Data) -- | Class representing hashing algorithms. -- @@ -76,7 +78,7 @@ newtype Context a = Context Bytes -- Creating a digest from a bytearray is also possible with function -- 'Crypto.Hash.digestFromByteString'. newtype Digest a = Digest (Block Word8) - deriving (Eq,Ord,ByteArrayAccess) + deriving (Eq,Ord,ByteArrayAccess, Data) instance NFData (Digest a) where rnf (Digest u) = u `deepseq` ()