module Unison.Hashing.V2.Causal ( Causal (..), ) where import Data.Set qualified as Set import Unison.Hash (Hash) import Unison.Hashing.ContentAddressable (ContentAddressable (..)) import Unison.Hashing.V2.Tokenizable qualified as H import Unison.Prelude data Causal = Causal {Causal -> Hash branchHash :: Hash, Causal -> Set Hash parents :: Set Hash} instance ContentAddressable Causal where contentHash :: Causal -> Hash contentHash = Causal -> Hash forall t. Tokenizable t => t -> Hash H.hashTokenizable instance H.Tokenizable Causal where tokens :: Causal -> [Token] tokens Causal c = [Hash] -> [Token] forall t. Tokenizable t => t -> [Token] H.tokens ([Hash] -> [Token]) -> [Hash] -> [Token] forall a b. (a -> b) -> a -> b $ Causal -> Hash branchHash Causal c Hash -> [Hash] -> [Hash] forall a. a -> [a] -> [a] : Set Hash -> [Hash] forall a. Set a -> [a] Set.toList (Causal -> Set Hash parents Causal c)