<commit_before>{-# OPTIONS_GHC -fno-warn-redundant-constraints #-}
{-# LANGUAGE TypeApplications #-}

-- | `Arbitrary` instance for `Hash`
--
-- Moved to a separate module to suppress `redundant constraint`
-- warning about `Binary a` constraint
-- (discussion: https://github.com/input-output-hk/pos-haskell-prototype/commit/b0655df210ffcdb3bad6610fe8af8d8d6bd4dfca#commitcomment-19576619)

module Pos.Crypto.Arbitrary.Hash () where

import           Data.Binary        (Binary)
import           Test.QuickCheck    (Arbitrary (..))
import           Universum

import           Pos.Crypto.Hashing (Hash, unsafeHash)
import           Pos.Util.Arbitrary (ArbitraryUnsafe)

instance Binary a => Arbitrary (Hash a) where
    arbitrary = unsafeHash @ByteString <$> arbitrary

instance Binary a => ArbitraryUnsafe (Hash a)<commit_msg>Fix benchmarks after dirty merge<commit_after>{-# OPTIONS_GHC -fno-warn-redundant-constraints #-}
{-# LANGUAGE TypeApplications #-}

-- | `Arbitrary` instance for `Hash`
--
-- Moved to a separate module to suppress `redundant constraint`
-- warning about `Binary a` constraint
-- (discussion: https://github.com/input-output-hk/pos-haskell-prototype/commit/b0655df210ffcdb3bad6610fe8af8d8d6bd4dfca#commitcomment-19576619)

module Pos.Crypto.Arbitrary.Hash () where

import           Data.Binary        (Binary)
import           Test.QuickCheck    (Arbitrary (..))
import           Universum

import           Pos.Crypto.Hashing (Hash, unsafeHash)

instance Binary a => Arbitrary (Hash a) where
    arbitrary = unsafeHash @ByteString <$> arbitrary
{'fraction_non_alphanumeric': 0.11181702668360864, 'fraction_numerical': 0.03176620076238882, 'mean_word_length': 3.4744318181818183, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 8, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '647140', 'n_tokens_mistral': 535, 'n_tokens_neox': 496, 'n_words': 114}