module Ledger.Core.Foreign.Crypto.Base where

open import Ledger.Prelude
open import Ledger.Prelude.Foreign.HSTypes

open import Ledger.Core.Specification.Crypto

open import Foreign.HaskellTypes.Deriving
open import Foreign.Convertible.Deriving
open import Tactic.Derive.Show

record HSVKey : Type where
  constructor MkHSVKey
  field hvkVKey       : 
        hvkStoredHash : 

unquoteDecl DecEq-HSVKey = derive-DecEq ((quote HSVKey , DecEq-HSVKey)  [])

instance
  Hashable-HSVKey : Hashable HSVKey 
  Hashable-HSVKey = λ where .hash  HSVKey.hvkStoredHash

  isHashableSet-HSVKey : isHashableSet HSVKey
  isHashableSet-HSVKey = mkIsHashableSet 

  Hashable-ℕ : Hashable  
  Hashable-ℕ = λ where .hash  id

  isHashableSet-ℕ : isHashableSet 
  isHashableSet-ℕ = mkIsHashableSet 

  HashableSet-ℕ : HashableSet
  HashableSet-ℕ = mkHashableSet 

  HsTy-HSVKey = autoHsType HSVKey
  Conv-HSVKey = autoConvert HSVKey

unquoteDecl Show-HSVKey = derive-Show
  ((quote HSVKey , Show-HSVKey)  [])