module Unison.Hashing.V2.Patch ( Patch (..), ) where import Unison.Hashing.ContentAddressable (ContentAddressable (contentHash)) import Unison.Hashing.V2.Reference (Reference) import Unison.Hashing.V2.Referent (Referent) import Unison.Hashing.V2.TermEdit (TermEdit) import Unison.Hashing.V2.Tokenizable (Tokenizable) import Unison.Hashing.V2.Tokenizable qualified as H import Unison.Hashing.V2.TypeEdit (TypeEdit) import Unison.Prelude data Patch = Patch { Patch -> Map Referent (Set TermEdit) termEdits :: Map Referent (Set TermEdit), Patch -> Map Reference (Set TypeEdit) typeEdits :: Map Reference (Set TypeEdit) } instance ContentAddressable Patch where contentHash :: Patch -> Hash contentHash = Patch -> Hash forall t. Tokenizable t => t -> Hash H.hashTokenizable instance Tokenizable Patch where tokens :: Patch -> [Token] tokens Patch p = [ Map Referent (Set TermEdit) -> Token forall t. Tokenizable t => t -> Token H.accumulateToken (Patch -> Map Referent (Set TermEdit) termEdits Patch p), Map Reference (Set TypeEdit) -> Token forall t. Tokenizable t => t -> Token H.accumulateToken (Patch -> Map Reference (Set TypeEdit) typeEdits Patch p) ]