unison-hashing-v2-0.0.0
Safe HaskellSafe-Inferred
LanguageHaskell2010

Unison.Hashing.V2

Contents

Description

This module exports:

  • Data types with ContentAddressable instances that correspond to v2 of the Unison hash function.
  • Miscellaneous helper functions related to hashing.
Synopsis

Documentation

data Branch Source #

Instances

Instances details
Show Branch Source # 
Instance details

Defined in Unison.Hashing.V2.Branch

Eq Branch Source # 
Instance details

Defined in Unison.Hashing.V2.Branch

Methods

(==) :: Branch -> Branch -> Bool #

(/=) :: Branch -> Branch -> Bool #

Ord Branch Source # 
Instance details

Defined in Unison.Hashing.V2.Branch

ContentAddressable Branch Source # 
Instance details

Defined in Unison.Hashing.V2.Branch

Methods

contentHash :: Branch -> Hash #

data Causal Source #

Constructors

Causal 

Fields

Instances

Instances details
ContentAddressable Causal Source # 
Instance details

Defined in Unison.Hashing.V2.Causal

Methods

contentHash :: Causal -> Hash #

data DataDeclaration v a Source #

Constructors

DataDeclaration 

Fields

Instances

Instances details
Functor (DataDeclaration v) Source # 
Instance details

Defined in Unison.Hashing.V2.DataDeclaration

Methods

fmap :: (a -> b) -> DataDeclaration v a -> DataDeclaration v b #

(<$) :: a -> DataDeclaration v b -> DataDeclaration v a #

newtype EffectDeclaration v a Source #

Constructors

EffectDeclaration 

Instances

Instances details
Functor (EffectDeclaration v) Source # 
Instance details

Defined in Unison.Hashing.V2.DataDeclaration

Methods

fmap :: (a -> b) -> EffectDeclaration v a -> EffectDeclaration v b #

(<$) :: a -> EffectDeclaration v b -> EffectDeclaration v a #

data Kind Source #

Constructors

KindStar 
KindArrow Kind Kind 

Instances

Instances details
Generic Kind Source # 
Instance details

Defined in Unison.Hashing.V2.Kind

Associated Types

type Rep Kind :: Type -> Type #

Methods

from :: Kind -> Rep Kind x #

to :: Rep Kind x -> Kind #

Read Kind Source # 
Instance details

Defined in Unison.Hashing.V2.Kind

Show Kind Source # 
Instance details

Defined in Unison.Hashing.V2.Kind

Methods

showsPrec :: Int -> Kind -> ShowS #

show :: Kind -> String #

showList :: [Kind] -> ShowS #

Eq Kind Source # 
Instance details

Defined in Unison.Hashing.V2.Kind

Methods

(==) :: Kind -> Kind -> Bool #

(/=) :: Kind -> Kind -> Bool #

Ord Kind Source # 
Instance details

Defined in Unison.Hashing.V2.Kind

Methods

compare :: Kind -> Kind -> Ordering #

(<) :: Kind -> Kind -> Bool #

(<=) :: Kind -> Kind -> Bool #

(>) :: Kind -> Kind -> Bool #

(>=) :: Kind -> Kind -> Bool #

max :: Kind -> Kind -> Kind #

min :: Kind -> Kind -> Kind #

type Rep Kind Source # 
Instance details

Defined in Unison.Hashing.V2.Kind

type Rep Kind = D1 ('MetaData "Kind" "Unison.Hashing.V2.Kind" "unison-hashing-v2-0.0.0-7iebuj6iVBw3qjQtwv5bsW" 'False) (C1 ('MetaCons "KindStar" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "KindArrow" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Kind) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Kind)))

data MatchCase loc a Source #

Constructors

MatchCase (Pattern loc) (Maybe a) a 

Instances

Instances details
Generic1 (MatchCase loc :: Type -> Type) Source # 
Instance details

Defined in Unison.Hashing.V2.Term

Associated Types

type Rep1 (MatchCase loc) :: k -> Type #

Methods

from1 :: forall (a :: k). MatchCase loc a -> Rep1 (MatchCase loc) a #

to1 :: forall (a :: k). Rep1 (MatchCase loc) a -> MatchCase loc a #

Foldable (MatchCase loc) Source # 
Instance details

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 #

sum :: Num a => MatchCase loc a -> a #

product :: Num a => MatchCase loc a -> a #

Traversable (MatchCase loc) Source # 
Instance details

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) #

Functor (MatchCase loc) Source # 
Instance details

Defined in Unison.Hashing.V2.Term

Methods

fmap :: (a -> b) -> MatchCase loc a -> MatchCase loc b #

(<$) :: a -> MatchCase loc b -> MatchCase loc a #

Generic (MatchCase loc a) Source # 
Instance details

Defined in Unison.Hashing.V2.Term

Associated Types

type Rep (MatchCase loc a) :: Type -> Type #

Methods

from :: MatchCase loc a -> Rep (MatchCase loc a) x #

to :: Rep (MatchCase loc a) x -> MatchCase loc a #

(Show loc, Show a) => Show (MatchCase loc a) Source # 
Instance details

Defined in Unison.Hashing.V2.Term

Methods

showsPrec :: Int -> MatchCase loc a -> ShowS #

show :: MatchCase loc a -> String #

showList :: [MatchCase loc a] -> ShowS #

Eq a => Eq (MatchCase loc a) Source # 
Instance details

Defined in Unison.Hashing.V2.Term

Methods

(==) :: MatchCase loc a -> MatchCase loc a -> Bool #

(/=) :: MatchCase loc a -> MatchCase loc a -> Bool #

type Rep1 (MatchCase loc :: Type -> Type) Source # 
Instance details

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-7iebuj6iVBw3qjQtwv5bsW" '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 # 
Instance details

Defined in Unison.Hashing.V2.Term

type Rep (MatchCase loc a) = D1 ('MetaData "MatchCase" "Unison.Hashing.V2.Term" "unison-hashing-v2-0.0.0-7iebuj6iVBw3qjQtwv5bsW" '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))))

newtype MdValues Source #

Constructors

MdValues (Set MetadataValue) 

Instances

Instances details
Show MdValues Source # 
Instance details

Defined in Unison.Hashing.V2.Branch

Eq MdValues Source # 
Instance details

Defined in Unison.Hashing.V2.Branch

Ord MdValues Source # 
Instance details

Defined in Unison.Hashing.V2.Branch

data Patch Source #

Instances

Instances details
ContentAddressable Patch Source # 
Instance details

Defined in Unison.Hashing.V2.Patch

Methods

contentHash :: Patch -> Hash #

data Pattern loc Source #

Instances

Instances details
Foldable Pattern Source # 
Instance details

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 #

toList :: Pattern a -> [a] #

null :: Pattern a -> Bool #

length :: Pattern a -> Int #

elem :: Eq a => a -> Pattern a -> Bool #

maximum :: Ord a => Pattern a -> a #

minimum :: Ord a => Pattern a -> a #

sum :: Num a => Pattern a -> a #

product :: Num a => Pattern a -> a #

Traversable Pattern Source # 
Instance details

Defined in Unison.Hashing.V2.Pattern

Methods

traverse :: Applicative f => (a -> f b) -> Pattern a -> f (Pattern b) #

sequenceA :: Applicative f => Pattern (f a) -> f (Pattern a) #

mapM :: Monad m => (a -> m b) -> Pattern a -> m (Pattern b) #

sequence :: Monad m => Pattern (m a) -> m (Pattern a) #

Functor Pattern Source # 
Instance details

Defined in Unison.Hashing.V2.Pattern

Methods

fmap :: (a -> b) -> Pattern a -> Pattern b #

(<$) :: a -> Pattern b -> Pattern a #

Generic (Pattern loc) Source # 
Instance details

Defined in Unison.Hashing.V2.Pattern

Associated Types

type Rep (Pattern loc) :: Type -> Type #

Methods

from :: Pattern loc -> Rep (Pattern loc) x #

to :: Rep (Pattern loc) x -> Pattern loc #

Show loc => Show (Pattern loc) Source # 
Instance details

Defined in Unison.Hashing.V2.Pattern

Methods

showsPrec :: Int -> Pattern loc -> ShowS #

show :: Pattern loc -> String #

showList :: [Pattern loc] -> ShowS #

Eq (Pattern loc) Source # 
Instance details

Defined in Unison.Hashing.V2.Pattern

Methods

(==) :: Pattern loc -> Pattern loc -> Bool #

(/=) :: Pattern loc -> Pattern loc -> Bool #

Ord loc => Ord (Pattern loc) Source # 
Instance details

Defined in Unison.Hashing.V2.Pattern

Methods

compare :: Pattern loc -> Pattern loc -> Ordering #

(<) :: Pattern loc -> Pattern loc -> Bool #

(<=) :: Pattern loc -> Pattern loc -> Bool #

(>) :: Pattern loc -> Pattern loc -> Bool #

(>=) :: Pattern loc -> Pattern loc -> Bool #

max :: Pattern loc -> Pattern loc -> Pattern loc #

min :: Pattern loc -> Pattern loc -> Pattern loc #

type Rep (Pattern loc) Source # 
Instance details

Defined in Unison.Hashing.V2.Pattern

type Rep (Pattern loc) = D1 ('MetaData "Pattern" "Unison.Hashing.V2.Pattern" "unison-hashing-v2-0.0.0-7iebuj6iVBw3qjQtwv5bsW" '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))))))))

data Reference Source #

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.

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 

data Referent Source #

Constructors

ReferentRef Reference 
ReferentCon Reference ConstructorId 

Instances

Instances details
Show Referent Source # 
Instance details

Defined in Unison.Hashing.V2.Referent

Eq Referent Source # 
Instance details

Defined in Unison.Hashing.V2.Referent

Ord Referent Source # 
Instance details

Defined in Unison.Hashing.V2.Referent

data SeqOp Source #

Constructors

Cons 
Snoc 
Concat 

Instances

Instances details
Generic SeqOp Source # 
Instance details

Defined in Unison.Hashing.V2.Pattern

Associated Types

type Rep SeqOp :: Type -> Type #

Methods

from :: SeqOp -> Rep SeqOp x #

to :: Rep SeqOp x -> SeqOp #

Show SeqOp Source # 
Instance details

Defined in Unison.Hashing.V2.Pattern

Methods

showsPrec :: Int -> SeqOp -> ShowS #

show :: SeqOp -> String #

showList :: [SeqOp] -> ShowS #

Eq SeqOp Source # 
Instance details

Defined in Unison.Hashing.V2.Pattern

Methods

(==) :: SeqOp -> SeqOp -> Bool #

(/=) :: SeqOp -> SeqOp -> Bool #

Ord SeqOp Source # 
Instance details

Defined in Unison.Hashing.V2.Pattern

Methods

compare :: SeqOp -> SeqOp -> Ordering #

(<) :: SeqOp -> SeqOp -> Bool #

(<=) :: SeqOp -> SeqOp -> Bool #

(>) :: SeqOp -> SeqOp -> Bool #

(>=) :: SeqOp -> SeqOp -> Bool #

max :: SeqOp -> SeqOp -> SeqOp #

min :: SeqOp -> SeqOp -> SeqOp #

type Rep SeqOp Source # 
Instance details

Defined in Unison.Hashing.V2.Pattern

type Rep SeqOp = D1 ('MetaData "SeqOp" "Unison.Hashing.V2.Pattern" "unison-hashing-v2-0.0.0-7iebuj6iVBw3qjQtwv5bsW" '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

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.

Instances

Instances details
Generic1 (TermF typeVar typeAnn patternAnn :: Type -> Type) Source # 
Instance details

Defined in Unison.Hashing.V2.Term

Associated Types

type Rep1 (TermF typeVar typeAnn patternAnn) :: k -> Type #

Methods

from1 :: forall (a :: k). TermF typeVar typeAnn patternAnn a -> Rep1 (TermF typeVar typeAnn patternAnn) a #

to1 :: forall (a :: k). Rep1 (TermF typeVar typeAnn patternAnn) a -> TermF typeVar typeAnn patternAnn a #

Foldable (TermF typeVar typeAnn patternAnn) Source # 
Instance details

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 # 
Instance details

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) #

Functor (TermF typeVar typeAnn patternAnn) Source # 
Instance details

Defined in Unison.Hashing.V2.Term

Methods

fmap :: (a -> b) -> TermF typeVar typeAnn patternAnn a -> TermF typeVar typeAnn patternAnn b #

(<$) :: a -> TermF typeVar typeAnn patternAnn b -> TermF typeVar typeAnn patternAnn a #

Generic (TermF typeVar typeAnn patternAnn a) Source # 
Instance details

Defined in Unison.Hashing.V2.Term

Associated Types

type Rep (TermF typeVar typeAnn patternAnn a) :: Type -> Type #

Methods

from :: TermF typeVar typeAnn patternAnn a -> Rep (TermF typeVar typeAnn patternAnn a) x #

to :: Rep (TermF typeVar typeAnn patternAnn a) x -> TermF typeVar typeAnn patternAnn a #

type Rep1 (TermF typeVar typeAnn patternAnn :: Type -> Type) Source # 
Instance details

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-7iebuj6iVBw3qjQtwv5bsW" '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 List) :*: 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) (List :.: 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 # 
Instance details

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-7iebuj6iVBw3qjQtwv5bsW" '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

data TypeF a Source #

Base functor for types in the Unison language

Instances

Instances details
Foldable TypeF Source # 
Instance details

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 #

toList :: TypeF a -> [a] #

null :: TypeF a -> Bool #

length :: TypeF a -> Int #

elem :: Eq a => a -> TypeF a -> Bool #

maximum :: Ord a => TypeF a -> a #

minimum :: Ord a => TypeF a -> a #

sum :: Num a => TypeF a -> a #

product :: Num a => TypeF a -> a #

Traversable TypeF Source # 
Instance details

Defined in Unison.Hashing.V2.Type

Methods

traverse :: Applicative f => (a -> f b) -> TypeF a -> f (TypeF b) #

sequenceA :: Applicative f => TypeF (f a) -> f (TypeF a) #

mapM :: Monad m => (a -> m b) -> TypeF a -> m (TypeF b) #

sequence :: Monad m => TypeF (m a) -> m (TypeF a) #

Functor TypeF Source # 
Instance details

Defined in Unison.Hashing.V2.Type

Methods

fmap :: (a -> b) -> TypeF a -> TypeF b #

(<$) :: a -> TypeF b -> TypeF a #

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 :: forall v a extra. Var v => Map v (Term v a, Type v a, extra) -> Map v (ReferenceId, Term v a, Type v a, extra) 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

Instances details
ContentAddressable Branch Source # 
Instance details

Defined in Unison.Hashing.V2.Branch

Methods

contentHash :: Branch -> Hash #

ContentAddressable Causal Source # 
Instance details

Defined in Unison.Hashing.V2.Causal

Methods

contentHash :: Causal -> Hash #

ContentAddressable Patch Source # 
Instance details

Defined in Unison.Hashing.V2.Patch

Methods

contentHash :: Patch -> Hash #