{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE TypeFamilies #-}

module Cardano.Api.Hash
  ( Hash
  , CastHash(..)
  , AsType(AsHash)
  ) where

import           Data.Kind (Type)

import           Cardano.Api.HasTypeProxy


data family Hash keyrole :: Type

class CastHash roleA roleB where

    castHash :: Hash roleA -> Hash roleB


instance HasTypeProxy a => HasTypeProxy (Hash a) where
    data AsType (Hash a) = AsHash (AsType a)
    proxyToAsType :: Proxy (Hash a) -> AsType (Hash a)
proxyToAsType Proxy (Hash a)
_ = AsType a -> AsType (Hash a)
forall a. AsType a -> AsType (Hash a)
AsHash (Proxy a -> AsType a
forall t. HasTypeProxy t => Proxy t -> AsType t
proxyToAsType (forall a. Proxy a
forall k (t :: k). Proxy t
Proxy :: Proxy a))