| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Unison.Hashing.V2
Contents
Description
This module exports:
- Data types with
ContentAddressableinstances that correspond to v2 of the Unison hash function. - Miscellaneous helper functions related to hashing.
Synopsis
- data Branch = Branch {
- terms :: Map NameSegment (Map Referent MdValues)
- types :: Map NameSegment (Map Reference MdValues)
- patches :: Map NameSegment Hash
- children :: Map NameSegment Hash
- data Causal = Causal {
- branchHash :: Hash
- parents :: Set Hash
- data DataDeclaration v a = DataDeclaration {
- modifier :: Modifier
- annotation :: a
- bound :: [v]
- constructors' :: [(a, v, Type v a)]
- type Decl v a = Either (EffectDeclaration v a) (DataDeclaration v a)
- newtype EffectDeclaration v a = EffectDeclaration {
- toDataDecl :: DataDeclaration v a
- data Kind
- data MatchCase loc a = MatchCase (Pattern loc) (Maybe a) a
- newtype MdValues = MdValues (Set MetadataValue)
- data Modifier
- = Structural
- | Unique Text
- newtype NameSegment = NameSegment Text
- data Patch = Patch {}
- data Pattern loc
- = PatternUnbound loc
- | PatternVar loc
- | PatternBoolean loc !Bool
- | PatternInt loc !Int64
- | PatternNat loc !Word64
- | PatternFloat loc !Double
- | PatternText loc !Text
- | PatternChar loc !Char
- | PatternConstructor loc !Reference !ConstructorId [Pattern loc]
- | PatternAs loc (Pattern loc)
- | PatternEffectPure loc (Pattern loc)
- | PatternEffectBind loc !Reference !ConstructorId [Pattern loc] (Pattern loc)
- | PatternSequenceLiteral loc [Pattern loc]
- | PatternSequenceOp loc (Pattern loc) !SeqOp (Pattern loc)
- data Reference
- pattern ReferenceDerived :: Hash -> Pos -> Reference
- data ReferenceId = ReferenceId Hash Pos
- data Referent
- = ReferentRef Reference
- | ReferentCon Reference ConstructorId
- data SeqOp
- type Term v a = Term2 v a a v a
- data TermEdit
- data TermF typeVar typeAnn patternAnn a
- = TermInt Int64
- | TermNat Word64
- | TermFloat Double
- | TermBoolean Bool
- | TermText Text
- | TermChar Char
- | TermBlank (Blank typeAnn)
- | TermRef Reference
- | TermConstructor Reference ConstructorId
- | TermRequest Reference ConstructorId
- | TermHandle a a
- | TermApp a a
- | TermAnn a (Type typeVar typeAnn)
- | TermList (Seq a)
- | TermIf a a a
- | TermAnd a a
- | TermOr a a
- | TermLam a
- | TermLetRec [a] a
- | TermLet a a
- | TermMatch a [MatchCase patternAnn a]
- | TermTermLink Referent
- | TermTypeLink Reference
- type Type v a = Term TypeF v a
- data TypeEdit
- data TypeF a
- = TypeRef Reference
- | TypeArrow a a
- | TypeAnn a Kind
- | TypeApp a a
- | TypeEffect a a
- | TypeEffects [a]
- | TypeForall a
- | TypeIntroOuter a
- data HashingWarning = IncompleteElementOrderingError (NonEmpty (NonEmpty String))
- crashOnHashingWarning :: HasCallStack => ([HashingWarning], a) -> a
- hashClosedTerm :: Var v => Term v a -> ReferenceId
- hashDecls :: (Eq v, Var v, Show v) => (v -> Name) -> Map v (DataDeclaration v a) -> ResolutionResult a [(v, ReferenceId, DataDeclaration v a)]
- hashTermComponents :: Var v => Map v (Term v a, Type v a, extra) -> ([HashingWarning], Map v (ReferenceId, Term v a, Type v a, extra))
- hashTermComponentsWithoutTypes :: Var v => Map v (Term v a) -> ([HashingWarning], Map v (ReferenceId, Term v a))
- typeToReference :: (Ord v, Show v) => Type v a -> Reference
- typeToReferenceMentions :: (Ord v, Show v) => Type v a -> Set Reference
- hashHistoryComment :: HistoryComment UTCTime KeyThumbprint CausalHash any -> HistoryComment UTCTime KeyThumbprint CausalHash HistoryCommentHash
- hashHistoryCommentRevision :: HistoryCommentRevision any UTCTime HistoryCommentHash -> HistoryCommentRevision HistoryCommentRevisionHash UTCTime HistoryCommentHash
- class ContentAddressable a where
- contentHash :: a -> Hash
Documentation
Constructors
| Branch | |
Fields
| |
Instances
| ContentAddressable Causal Source # | |
Defined in Unison.Hashing.V2.Causal Methods contentHash :: Causal -> Hash # | |
data DataDeclaration v a Source #
Constructors
| DataDeclaration | |
Fields
| |
Instances
| Functor (DataDeclaration v) Source # | |
Defined in Unison.Hashing.V2.DataDeclaration Methods fmap :: (a -> b) -> DataDeclaration v a -> DataDeclaration v b # (<$) :: a -> DataDeclaration v b -> DataDeclaration v a # | |
type Decl v a = Either (EffectDeclaration v a) (DataDeclaration v a) Source #
newtype EffectDeclaration v a Source #
Constructors
| EffectDeclaration | |
Fields
| |
Instances
| Functor (EffectDeclaration v) Source # | |
Defined in Unison.Hashing.V2.DataDeclaration Methods fmap :: (a -> b) -> EffectDeclaration v a -> EffectDeclaration v b # (<$) :: a -> EffectDeclaration v b -> EffectDeclaration v a # | |
Instances
Instances
| Generic1 (MatchCase loc :: Type -> Type) Source # | |||||
Defined in Unison.Hashing.V2.Term Associated Types
| |||||
| Functor (MatchCase loc) Source # | |||||
| Foldable (MatchCase loc) Source # | |||||
Defined in Unison.Hashing.V2.Term Methods fold :: Monoid m => MatchCase loc m -> m # foldMap :: Monoid m => (a -> m) -> MatchCase loc a -> m # foldMap' :: Monoid m => (a -> m) -> MatchCase loc a -> m # foldr :: (a -> b -> b) -> b -> MatchCase loc a -> b # foldr' :: (a -> b -> b) -> b -> MatchCase loc a -> b # foldl :: (b -> a -> b) -> b -> MatchCase loc a -> b # foldl' :: (b -> a -> b) -> b -> MatchCase loc a -> b # foldr1 :: (a -> a -> a) -> MatchCase loc a -> a # foldl1 :: (a -> a -> a) -> MatchCase loc a -> a # toList :: MatchCase loc a -> [a] # null :: MatchCase loc a -> Bool # length :: MatchCase loc a -> Int # elem :: Eq a => a -> MatchCase loc a -> Bool # maximum :: Ord a => MatchCase loc a -> a # minimum :: Ord a => MatchCase loc a -> a # | |||||
| Traversable (MatchCase loc) Source # | |||||
Defined in Unison.Hashing.V2.Term Methods traverse :: Applicative f => (a -> f b) -> MatchCase loc a -> f (MatchCase loc b) # sequenceA :: Applicative f => MatchCase loc (f a) -> f (MatchCase loc a) # mapM :: Monad m => (a -> m b) -> MatchCase loc a -> m (MatchCase loc b) # sequence :: Monad m => MatchCase loc (m a) -> m (MatchCase loc a) # | |||||
| Generic (MatchCase loc a) Source # | |||||
Defined in Unison.Hashing.V2.Term Associated Types
| |||||
| (Show loc, Show a) => Show (MatchCase loc a) Source # | |||||
| Eq a => Eq (MatchCase loc a) Source # | |||||
| type Rep1 (MatchCase loc :: Type -> Type) Source # | |||||
Defined in Unison.Hashing.V2.Term type Rep1 (MatchCase loc :: Type -> Type) = D1 ('MetaData "MatchCase" "Unison.Hashing.V2.Term" "unison-hashing-v2-0.0.0-GQ1DQobTpmQFpHJ1svA7jD" 'False) (C1 ('MetaCons "MatchCase" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Pattern loc)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 Maybe) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1))) | |||||
| type Rep (MatchCase loc a) Source # | |||||
Defined in Unison.Hashing.V2.Term type Rep (MatchCase loc a) = D1 ('MetaData "MatchCase" "Unison.Hashing.V2.Term" "unison-hashing-v2-0.0.0-GQ1DQobTpmQFpHJ1svA7jD" 'False) (C1 ('MetaCons "MatchCase" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Pattern loc)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe a)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))) | |||||
Constructors
| Structural | |
| Unique Text |
newtype NameSegment Source #
A name segment.
Constructors
| NameSegment Text |
Instances
| Show NameSegment Source # | |
Defined in Unison.Hashing.V2.NameSegment Methods showsPrec :: Int -> NameSegment -> ShowS # show :: NameSegment -> String # showList :: [NameSegment] -> ShowS # | |
| Eq NameSegment Source # | |
Defined in Unison.Hashing.V2.NameSegment | |
| Ord NameSegment Source # | |
Defined in Unison.Hashing.V2.NameSegment Methods compare :: NameSegment -> NameSegment -> Ordering # (<) :: NameSegment -> NameSegment -> Bool # (<=) :: NameSegment -> NameSegment -> Bool # (>) :: NameSegment -> NameSegment -> Bool # (>=) :: NameSegment -> NameSegment -> Bool # max :: NameSegment -> NameSegment -> NameSegment # min :: NameSegment -> NameSegment -> NameSegment # | |
Constructors
| Patch | |
Instances
| ContentAddressable Patch Source # | |
Defined in Unison.Hashing.V2.Patch Methods contentHash :: Patch -> Hash # | |
Constructors
| PatternUnbound loc | |
| PatternVar loc | |
| PatternBoolean loc !Bool | |
| PatternInt loc !Int64 | |
| PatternNat loc !Word64 | |
| PatternFloat loc !Double | |
| PatternText loc !Text | |
| PatternChar loc !Char | |
| PatternConstructor loc !Reference !ConstructorId [Pattern loc] | |
| PatternAs loc (Pattern loc) | |
| PatternEffectPure loc (Pattern loc) | |
| PatternEffectBind loc !Reference !ConstructorId [Pattern loc] (Pattern loc) | |
| PatternSequenceLiteral loc [Pattern loc] | |
| PatternSequenceOp loc (Pattern loc) !SeqOp (Pattern loc) |
Instances
| Functor Pattern Source # | |||||
| Foldable Pattern Source # | |||||
Defined in Unison.Hashing.V2.Pattern Methods fold :: Monoid m => Pattern m -> m # foldMap :: Monoid m => (a -> m) -> Pattern a -> m # foldMap' :: Monoid m => (a -> m) -> Pattern a -> m # foldr :: (a -> b -> b) -> b -> Pattern a -> b # foldr' :: (a -> b -> b) -> b -> Pattern a -> b # foldl :: (b -> a -> b) -> b -> Pattern a -> b # foldl' :: (b -> a -> b) -> b -> Pattern a -> b # foldr1 :: (a -> a -> a) -> Pattern a -> a # foldl1 :: (a -> a -> a) -> Pattern a -> a # elem :: Eq a => a -> Pattern a -> Bool # maximum :: Ord a => Pattern a -> a # minimum :: Ord a => Pattern a -> a # | |||||
| Traversable Pattern Source # | |||||
| Generic (Pattern loc) Source # | |||||
Defined in Unison.Hashing.V2.Pattern Associated Types
| |||||
| Show loc => Show (Pattern loc) Source # | |||||
| Eq (Pattern loc) Source # | |||||
| Ord loc => Ord (Pattern loc) Source # | |||||
Defined in Unison.Hashing.V2.Pattern | |||||
| type Rep (Pattern loc) Source # | |||||
Defined in Unison.Hashing.V2.Pattern type Rep (Pattern loc) = D1 ('MetaData "Pattern" "Unison.Hashing.V2.Pattern" "unison-hashing-v2-0.0.0-GQ1DQobTpmQFpHJ1svA7jD" 'False) (((C1 ('MetaCons "PatternUnbound" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 loc)) :+: (C1 ('MetaCons "PatternVar" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 loc)) :+: C1 ('MetaCons "PatternBoolean" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 loc) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Bool)))) :+: ((C1 ('MetaCons "PatternInt" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 loc) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int64)) :+: C1 ('MetaCons "PatternNat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 loc) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64))) :+: (C1 ('MetaCons "PatternFloat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 loc) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Double)) :+: C1 ('MetaCons "PatternText" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 loc) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text))))) :+: ((C1 ('MetaCons "PatternChar" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 loc) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Char)) :+: (C1 ('MetaCons "PatternConstructor" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 loc) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Reference)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ConstructorId) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Pattern loc]))) :+: C1 ('MetaCons "PatternAs" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 loc) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Pattern loc))))) :+: ((C1 ('MetaCons "PatternEffectPure" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 loc) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Pattern loc))) :+: C1 ('MetaCons "PatternEffectBind" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 loc) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Reference)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ConstructorId) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Pattern loc]) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Pattern loc)))))) :+: (C1 ('MetaCons "PatternSequenceLiteral" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 loc) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Pattern loc])) :+: C1 ('MetaCons "PatternSequenceOp" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 loc) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Pattern loc))) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 SeqOp) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Pattern loc)))))))) | |||||
Either a builtin or a user defined (hashed) top-level declaration.
Used for both terms and types. Doesn't distinguish between them.
Other used defined things like local variables don't get References.
Constructors
| ReferenceBuiltin Text | |
| ReferenceDerivedId ReferenceId |
Instances
| Show Reference Source # | |
| Eq Reference Source # | |
| Ord Reference Source # | |
pattern ReferenceDerived :: Hash -> Pos -> Reference Source #
data ReferenceId Source #
Pos is a position into a cycle of size Size, as cycles are hashed together.
Constructors
| ReferenceId Hash Pos |
Instances
| Show ReferenceId Source # | |
Defined in Unison.Hashing.V2.Reference Methods showsPrec :: Int -> ReferenceId -> ShowS # show :: ReferenceId -> String # showList :: [ReferenceId] -> ShowS # | |
| Eq ReferenceId Source # | |
Defined in Unison.Hashing.V2.Reference | |
| Ord ReferenceId Source # | |
Defined in Unison.Hashing.V2.Reference Methods compare :: ReferenceId -> ReferenceId -> Ordering # (<) :: ReferenceId -> ReferenceId -> Bool # (<=) :: ReferenceId -> ReferenceId -> Bool # (>) :: ReferenceId -> ReferenceId -> Bool # (>=) :: ReferenceId -> ReferenceId -> Bool # max :: ReferenceId -> ReferenceId -> ReferenceId # min :: ReferenceId -> ReferenceId -> ReferenceId # | |
Constructors
| ReferentRef Reference | |
| ReferentCon Reference ConstructorId |
Instances
| Generic SeqOp Source # | |||||
Defined in Unison.Hashing.V2.Pattern Associated Types
| |||||
| Show SeqOp Source # | |||||
| Eq SeqOp Source # | |||||
| Ord SeqOp Source # | |||||
| type Rep SeqOp Source # | |||||
Defined in Unison.Hashing.V2.Pattern type Rep SeqOp = D1 ('MetaData "SeqOp" "Unison.Hashing.V2.Pattern" "unison-hashing-v2-0.0.0-GQ1DQobTpmQFpHJ1svA7jD" 'False) (C1 ('MetaCons "Cons" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Snoc" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Concat" 'PrefixI 'False) (U1 :: Type -> Type))) | |||||
type Term v a = Term2 v a a v a Source #
Like `Term v`, but with an annotation of type a at every level in the tree
Constructors
| TermEditReplace Referent | |
| TermEditDeprecate |
data TermF typeVar typeAnn patternAnn a Source #
Base functor for terms in the Unison language
We need typeVar because the term and type variables may differ.
Constructors
| TermInt Int64 | |
| TermNat Word64 | |
| TermFloat Double | |
| TermBoolean Bool | |
| TermText Text | |
| TermChar Char | |
| TermBlank (Blank typeAnn) | |
| TermRef Reference | |
| TermConstructor Reference ConstructorId | |
| TermRequest Reference ConstructorId | |
| TermHandle a a | |
| TermApp a a | |
| TermAnn a (Type typeVar typeAnn) | |
| TermList (Seq a) | |
| TermIf a a a | |
| TermAnd a a | |
| TermOr a a | |
| TermLam a | |
| TermLetRec [a] a | |
| TermLet a a | |
| TermMatch a [MatchCase patternAnn a] | |
| TermTermLink Referent | |
| TermTypeLink Reference |
Instances
| Generic1 (TermF typeVar typeAnn patternAnn :: Type -> Type) Source # | |||||
Defined in Unison.Hashing.V2.Term Associated Types
| |||||
| Functor (TermF typeVar typeAnn patternAnn) Source # | |||||
| Foldable (TermF typeVar typeAnn patternAnn) Source # | |||||
Defined in Unison.Hashing.V2.Term Methods fold :: Monoid m => TermF typeVar typeAnn patternAnn m -> m # foldMap :: Monoid m => (a -> m) -> TermF typeVar typeAnn patternAnn a -> m # foldMap' :: Monoid m => (a -> m) -> TermF typeVar typeAnn patternAnn a -> m # foldr :: (a -> b -> b) -> b -> TermF typeVar typeAnn patternAnn a -> b # foldr' :: (a -> b -> b) -> b -> TermF typeVar typeAnn patternAnn a -> b # foldl :: (b -> a -> b) -> b -> TermF typeVar typeAnn patternAnn a -> b # foldl' :: (b -> a -> b) -> b -> TermF typeVar typeAnn patternAnn a -> b # foldr1 :: (a -> a -> a) -> TermF typeVar typeAnn patternAnn a -> a # foldl1 :: (a -> a -> a) -> TermF typeVar typeAnn patternAnn a -> a # toList :: TermF typeVar typeAnn patternAnn a -> [a] # null :: TermF typeVar typeAnn patternAnn a -> Bool # length :: TermF typeVar typeAnn patternAnn a -> Int # elem :: Eq a => a -> TermF typeVar typeAnn patternAnn a -> Bool # maximum :: Ord a => TermF typeVar typeAnn patternAnn a -> a # minimum :: Ord a => TermF typeVar typeAnn patternAnn a -> a # sum :: Num a => TermF typeVar typeAnn patternAnn a -> a # product :: Num a => TermF typeVar typeAnn patternAnn a -> a # | |||||
| Traversable (TermF typeVar typeAnn patternAnn) Source # | |||||
Defined in Unison.Hashing.V2.Term Methods traverse :: Applicative f => (a -> f b) -> TermF typeVar typeAnn patternAnn a -> f (TermF typeVar typeAnn patternAnn b) # sequenceA :: Applicative f => TermF typeVar typeAnn patternAnn (f a) -> f (TermF typeVar typeAnn patternAnn a) # mapM :: Monad m => (a -> m b) -> TermF typeVar typeAnn patternAnn a -> m (TermF typeVar typeAnn patternAnn b) # sequence :: Monad m => TermF typeVar typeAnn patternAnn (m a) -> m (TermF typeVar typeAnn patternAnn a) # | |||||
| Generic (TermF typeVar typeAnn patternAnn a) Source # | |||||
Defined in Unison.Hashing.V2.Term Associated Types
| |||||
| type Rep1 (TermF typeVar typeAnn patternAnn :: Type -> Type) Source # | |||||
Defined in Unison.Hashing.V2.Term type Rep1 (TermF typeVar typeAnn patternAnn :: Type -> Type) = D1 ('MetaData "TermF" "Unison.Hashing.V2.Term" "unison-hashing-v2-0.0.0-GQ1DQobTpmQFpHJ1svA7jD" 'False) ((((C1 ('MetaCons "TermInt" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int64)) :+: C1 ('MetaCons "TermNat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word64))) :+: (C1 ('MetaCons "TermFloat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Double)) :+: (C1 ('MetaCons "TermBoolean" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool)) :+: C1 ('MetaCons "TermText" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text))))) :+: ((C1 ('MetaCons "TermChar" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Char)) :+: (C1 ('MetaCons "TermBlank" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Blank typeAnn))) :+: C1 ('MetaCons "TermRef" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Reference)))) :+: (C1 ('MetaCons "TermConstructor" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Reference) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ConstructorId)) :+: (C1 ('MetaCons "TermRequest" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Reference) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ConstructorId)) :+: C1 ('MetaCons "TermHandle" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1 :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1))))) :+: (((C1 ('MetaCons "TermApp" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1 :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1) :+: (C1 ('MetaCons "TermAnn" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1 :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Type typeVar typeAnn))) :+: C1 ('MetaCons "TermList" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 Seq)))) :+: (C1 ('MetaCons "TermIf" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1 :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1 :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1)) :+: (C1 ('MetaCons "TermAnd" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1 :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1) :+: C1 ('MetaCons "TermOr" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1 :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1)))) :+: ((C1 ('MetaCons "TermLam" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1) :+: (C1 ('MetaCons "TermLetRec" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 []) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1) :+: C1 ('MetaCons "TermLet" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1 :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1))) :+: (C1 ('MetaCons "TermMatch" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1 :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) ([] :.: Rec1 (MatchCase patternAnn))) :+: (C1 ('MetaCons "TermTermLink" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Referent)) :+: C1 ('MetaCons "TermTypeLink" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Reference))))))) | |||||
| type Rep (TermF typeVar typeAnn patternAnn a) Source # | |||||
Defined in Unison.Hashing.V2.Term type Rep (TermF typeVar typeAnn patternAnn a) = D1 ('MetaData "TermF" "Unison.Hashing.V2.Term" "unison-hashing-v2-0.0.0-GQ1DQobTpmQFpHJ1svA7jD" 'False) ((((C1 ('MetaCons "TermInt" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int64)) :+: C1 ('MetaCons "TermNat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word64))) :+: (C1 ('MetaCons "TermFloat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Double)) :+: (C1 ('MetaCons "TermBoolean" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool)) :+: C1 ('MetaCons "TermText" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text))))) :+: ((C1 ('MetaCons "TermChar" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Char)) :+: (C1 ('MetaCons "TermBlank" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Blank typeAnn))) :+: C1 ('MetaCons "TermRef" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Reference)))) :+: (C1 ('MetaCons "TermConstructor" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Reference) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ConstructorId)) :+: (C1 ('MetaCons "TermRequest" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Reference) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ConstructorId)) :+: C1 ('MetaCons "TermHandle" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))))) :+: (((C1 ('MetaCons "TermApp" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)) :+: (C1 ('MetaCons "TermAnn" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Type typeVar typeAnn))) :+: C1 ('MetaCons "TermList" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Seq a))))) :+: (C1 ('MetaCons "TermIf" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a))) :+: (C1 ('MetaCons "TermAnd" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)) :+: C1 ('MetaCons "TermOr" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a))))) :+: ((C1 ('MetaCons "TermLam" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)) :+: (C1 ('MetaCons "TermLetRec" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [a]) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)) :+: C1 ('MetaCons "TermLet" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))) :+: (C1 ('MetaCons "TermMatch" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [MatchCase patternAnn a])) :+: (C1 ('MetaCons "TermTermLink" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Referent)) :+: C1 ('MetaCons "TermTypeLink" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Reference))))))) | |||||
type Type v a = Term TypeF v a Source #
Types are represented as ABTs over the base functor F, with variables in v
Constructors
| TypeEditReplace Reference | |
| TypeEditDeprecate |
Base functor for types in the Unison language
Constructors
| TypeRef Reference | |
| TypeArrow a a | |
| TypeAnn a Kind | |
| TypeApp a a | |
| TypeEffect a a | |
| TypeEffects [a] | |
| TypeForall a | |
| TypeIntroOuter a |
Instances
| Functor TypeF Source # | |
| Foldable TypeF Source # | |
Defined in Unison.Hashing.V2.Type Methods fold :: Monoid m => TypeF m -> m # foldMap :: Monoid m => (a -> m) -> TypeF a -> m # foldMap' :: Monoid m => (a -> m) -> TypeF a -> m # foldr :: (a -> b -> b) -> b -> TypeF a -> b # foldr' :: (a -> b -> b) -> b -> TypeF a -> b # foldl :: (b -> a -> b) -> b -> TypeF a -> b # foldl' :: (b -> a -> b) -> b -> TypeF a -> b # foldr1 :: (a -> a -> a) -> TypeF a -> a # foldl1 :: (a -> a -> a) -> TypeF a -> a # elem :: Eq a => a -> TypeF a -> Bool # maximum :: Ord a => TypeF a -> a # minimum :: Ord a => TypeF a -> a # | |
| Traversable TypeF Source # | |
data HashingWarning Source #
Constructors
| IncompleteElementOrderingError (NonEmpty (NonEmpty String)) | two or more component elements can not be completely ordered with respect to one another https://github.com/unisonweb/unison/issues/2787 |
Instances
| Exception HashingWarning Source # | |
Defined in Unison.Hashing.V2.ABT Methods toException :: HashingWarning -> SomeException # fromException :: SomeException -> Maybe HashingWarning # displayException :: HashingWarning -> String # backtraceDesired :: HashingWarning -> Bool # | |
| Show HashingWarning Source # | |
Defined in Unison.Hashing.V2.ABT Methods showsPrec :: Int -> HashingWarning -> ShowS # show :: HashingWarning -> String # showList :: [HashingWarning] -> ShowS # | |
| Eq HashingWarning Source # | |
Defined in Unison.Hashing.V2.ABT Methods (==) :: HashingWarning -> HashingWarning -> Bool # (/=) :: HashingWarning -> HashingWarning -> Bool # | |
| Ord HashingWarning Source # | |
Defined in Unison.Hashing.V2.ABT Methods compare :: HashingWarning -> HashingWarning -> Ordering # (<) :: HashingWarning -> HashingWarning -> Bool # (<=) :: HashingWarning -> HashingWarning -> Bool # (>) :: HashingWarning -> HashingWarning -> Bool # (>=) :: HashingWarning -> HashingWarning -> Bool # max :: HashingWarning -> HashingWarning -> HashingWarning # min :: HashingWarning -> HashingWarning -> HashingWarning # | |
crashOnHashingWarning :: HasCallStack => ([HashingWarning], a) -> a Source #
Crash if hashing produced any warnings.
In the future we will hopefully prevent this error entirely.
hashClosedTerm :: Var v => Term v a -> ReferenceId Source #
hashDecls :: (Eq v, Var v, Show v) => (v -> Name) -> Map v (DataDeclaration v a) -> ResolutionResult a [(v, ReferenceId, DataDeclaration v a)] Source #
compute the hashes of these user defined types and update any free vars corresponding to these decls with the resulting hashes
data List a = Nil | Cons a (List a) becomes something like (List, #xyz, [forall a. #xyz a, forall a. a -> (#xyz a) -> (#xyz a)])
NOTE: technical limitation, this implementation gives diff results if ctors have the same FQN as one of the types. TODO: assert this and bomb if not satisfied, or else do local mangling and unmangling to ensure this doesn't affect the hash.
hashTermComponents :: Var v => Map v (Term v a, Type v a, extra) -> ([HashingWarning], Map v (ReferenceId, Term v a, Type v a, extra)) Source #
hashTermComponentsWithoutTypes :: Var v => Map v (Term v a) -> ([HashingWarning], Map v (ReferenceId, Term v a)) Source #
hashHistoryComment :: HistoryComment UTCTime KeyThumbprint CausalHash any -> HistoryComment UTCTime KeyThumbprint CausalHash HistoryCommentHash Source #
hashHistoryCommentRevision :: HistoryCommentRevision any UTCTime HistoryCommentHash -> HistoryCommentRevision HistoryCommentRevisionHash UTCTime HistoryCommentHash Source #
Re-exports
class ContentAddressable a where #
A type class that is inhabited by types that can compute a hash of their content.
The base instances of this class should only live in dedicated "hashing packages" such as unison-hashing-v2, whose
types and implementations should never change.
Trivial wrapper instances can be written around these, but note these pipelines from
MyType ==> SomeHashingType ==> Hash must take care not to change the MyType ==> SomeHashingType conversion, once
written.
For example, we might have a representation of some namespace in memory
data Namespace = Namespace Terms Types OtherStuff CachesAndWhatnot
with a somewhat equivalent "hashing" type in some "hashing package", with a ContentAddressable instance
data HashingNamespace = Namespace Terms Types
We can of course make our own convenience instance
instance ContentAddressable Namespace where contentHash = contentHash . namespaceToHashingNamespace
But we must make sure that the implementation of namespaceToHashingNamespace never changes the fields in the
corresponding HashingNamespace, even as features are added to or removed from Namespace.
Methods
contentHash :: a -> Hash #
Instances
| ContentAddressable Branch Source # | |
Defined in Unison.Hashing.V2.Branch Methods contentHash :: Branch -> Hash # | |
| ContentAddressable Causal Source # | |
Defined in Unison.Hashing.V2.Causal Methods contentHash :: Causal -> Hash # | |
| ContentAddressable Patch Source # | |
Defined in Unison.Hashing.V2.Patch Methods contentHash :: Patch -> Hash # | |
| ContentAddressable (HistoryCommentRevision any UTCTime HistoryCommentHash) Source # | |
Defined in Unison.Hashing.V2.HistoryComments Methods contentHash :: HistoryCommentRevision any UTCTime HistoryCommentHash -> Hash # | |
| ContentAddressable (HistoryComment UTCTime KeyThumbprint CausalHash any) Source # | |
Defined in Unison.Hashing.V2.HistoryComments Methods contentHash :: HistoryComment UTCTime KeyThumbprint CausalHash any -> Hash # | |