Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- type ConstructorId = Word64
- type Term v = Term (F v) v ()
- type HashableTerm v = Term (F' Text HashableTermRef TypeRef HashableTermLink TypeLink v) v ()
- type Type v = TypeR TypeRef v
- type TermRef = Reference' Text (Maybe Hash)
- type HashableTermRef = Reference' Text Hash
- type TypeRef = Reference
- type TermLink = Referent' (Reference' Text (Maybe Hash)) (Reference' Text Hash)
- type HashableTermLink = Referent' (Reference' Text Hash) (Reference' Text Hash)
- type TypeLink = Reference
- type F vt = F' Text TermRef TypeRef TermLink TypeLink vt
- data F' text termRef typeRef termLink typeLink vt a
- = Int Int64
- | Nat Word64
- | Float Double
- | Boolean Bool
- | Text text
- | Char Char
- | Ref termRef
- | Constructor typeRef ConstructorId
- | Request typeRef ConstructorId
- | Handle a a
- | App a a
- | Ann a (TypeR typeRef vt)
- | List (Seq a)
- | If a a a
- | And a a
- | Or a a
- | Lam a
- | LetRec [a] a
- | Let a a
- | Match a [MatchCase text typeRef a]
- | TermLink termLink
- | TypeLink typeLink
- data MatchCase t r a = MatchCase (Pattern t r) (Maybe a) a
- data Pattern t r
- = PUnbound
- | PVar
- | PBoolean !Bool
- | PInt !Int64
- | PNat !Word64
- | PFloat !Double
- | PText !t
- | PChar !Char
- | PConstructor !r !ConstructorId [Pattern t r]
- | PAs (Pattern t r)
- | PEffectPure (Pattern t r)
- | PEffectBind !r !ConstructorId [Pattern t r] (Pattern t r)
- | PSequenceLiteral [Pattern t r]
- | PSequenceOp (Pattern t r) !SeqOp (Pattern t r)
- data SeqOp
- extraMap :: forall text termRef typeRef termLink typeLink vt text' termRef' typeRef' termLink' typeLink' vt' v a. (Ord v, Ord vt') => (text -> text') -> (termRef -> termRef') -> (typeRef -> typeRef') -> (termLink -> termLink') -> (typeLink -> typeLink') -> (vt -> vt') -> Term (F' text termRef typeRef termLink typeLink vt) v a -> Term (F' text' termRef' typeRef' termLink' typeLink' vt') v a
- extraMapM :: forall m text termRef typeRef termLink typeLink vt text' termRef' typeRef' termLink' typeLink' vt' v a. (Ord v, Ord vt', Monad m) => (text -> m text') -> (termRef -> m termRef') -> (typeRef -> m typeRef') -> (termLink -> m termLink') -> (typeLink -> m typeLink') -> (vt -> m vt') -> Term (F' text termRef typeRef termLink typeLink vt) v a -> m (Term (F' text' termRef' typeRef' termLink' typeLink' vt') v a)
- rmapPattern :: (t -> t') -> (r -> r') -> Pattern t r -> Pattern t' r'
- rmapPatternM :: Applicative m => (t -> m t') -> (r -> m r') -> Pattern t r -> m (Pattern t' r')
- dependencies :: (Ord termRef, Ord typeRef, Ord termLink, Ord typeLink, Ord v) => Term (F' text termRef typeRef termLink typeLink vt) v a -> (Set termRef, Set typeRef, Set termLink, Set typeLink)
- unhashComponent :: forall v extra. Var v => Hash -> (Id -> v) -> Map Id (Term v, extra) -> Map Id (v, HashableTerm v, extra)
Documentation
type ConstructorId = Word64 Source #
type HashableTerm v = Term (F' Text HashableTermRef TypeRef HashableTermLink TypeLink v) v () Source #
type HashableTermRef = Reference' Text Hash Source #
type HashableTermLink = Referent' (Reference' Text Hash) (Reference' Text Hash) Source #
type F vt = F' Text TermRef TypeRef TermLink TypeLink vt Source #
Base functor for terms in the Unison codebase
data F' text termRef typeRef termLink typeLink vt a Source #
Generalized version. We could generalize further to allow sharing within terms.
Int Int64 | |
Nat Word64 | |
Float Double | |
Boolean Bool | |
Text text | |
Char Char | |
Ref termRef | |
Constructor typeRef ConstructorId | |
Request typeRef ConstructorId | |
Handle a a | |
App a a | |
Ann a (TypeR typeRef vt) | |
List (Seq a) | |
If a a a | |
And a a | |
Or a a | |
Lam a | |
LetRec [a] a | |
Let a a | |
Match a [MatchCase text typeRef a] | |
TermLink termLink | |
TypeLink typeLink |
Instances
Foldable (F' text termRef typeRef termLink typeLink vt) Source # | |
Defined in U.Codebase.Term fold :: Monoid m => F' text termRef typeRef termLink typeLink vt m -> m # foldMap :: Monoid m => (a -> m) -> F' text termRef typeRef termLink typeLink vt a -> m # foldMap' :: Monoid m => (a -> m) -> F' text termRef typeRef termLink typeLink vt a -> m # foldr :: (a -> b -> b) -> b -> F' text termRef typeRef termLink typeLink vt a -> b # foldr' :: (a -> b -> b) -> b -> F' text termRef typeRef termLink typeLink vt a -> b # foldl :: (b -> a -> b) -> b -> F' text termRef typeRef termLink typeLink vt a -> b # foldl' :: (b -> a -> b) -> b -> F' text termRef typeRef termLink typeLink vt a -> b # foldr1 :: (a -> a -> a) -> F' text termRef typeRef termLink typeLink vt a -> a # foldl1 :: (a -> a -> a) -> F' text termRef typeRef termLink typeLink vt a -> a # toList :: F' text termRef typeRef termLink typeLink vt a -> [a] # null :: F' text termRef typeRef termLink typeLink vt a -> Bool # length :: F' text termRef typeRef termLink typeLink vt a -> Int # elem :: Eq a => a -> F' text termRef typeRef termLink typeLink vt a -> Bool # maximum :: Ord a => F' text termRef typeRef termLink typeLink vt a -> a # minimum :: Ord a => F' text termRef typeRef termLink typeLink vt a -> a # sum :: Num a => F' text termRef typeRef termLink typeLink vt a -> a # product :: Num a => F' text termRef typeRef termLink typeLink vt a -> a # | |
Traversable (F' text termRef typeRef termLink typeLink vt) Source # | |
Defined in U.Codebase.Term traverse :: Applicative f => (a -> f b) -> F' text termRef typeRef termLink typeLink vt a -> f (F' text termRef typeRef termLink typeLink vt b) # sequenceA :: Applicative f => F' text termRef typeRef termLink typeLink vt (f a) -> f (F' text termRef typeRef termLink typeLink vt a) # mapM :: Monad m => (a -> m b) -> F' text termRef typeRef termLink typeLink vt a -> m (F' text termRef typeRef termLink typeLink vt b) # sequence :: Monad m => F' text termRef typeRef termLink typeLink vt (m a) -> m (F' text termRef typeRef termLink typeLink vt a) # | |
Functor (F' text termRef typeRef termLink typeLink vt) Source # | |
(Show text, Show termRef, Show vt, Show a, Show termLink, Show typeLink, Show typeRef) => Show (F' text termRef typeRef termLink typeLink vt a) Source # | |
Instances
PUnbound | |
PVar | |
PBoolean !Bool | |
PInt !Int64 | |
PNat !Word64 | |
PFloat !Double | |
PText !t | |
PChar !Char | |
PConstructor !r !ConstructorId [Pattern t r] | |
PAs (Pattern t r) | |
PEffectPure (Pattern t r) | |
PEffectBind !r !ConstructorId [Pattern t r] (Pattern t r) | |
PSequenceLiteral [Pattern t r] | |
PSequenceOp (Pattern t r) !SeqOp (Pattern t r) |
Instances
extraMap :: forall text termRef typeRef termLink typeLink vt text' termRef' typeRef' termLink' typeLink' vt' v a. (Ord v, Ord vt') => (text -> text') -> (termRef -> termRef') -> (typeRef -> typeRef') -> (termLink -> termLink') -> (typeLink -> typeLink') -> (vt -> vt') -> Term (F' text termRef typeRef termLink typeLink vt) v a -> Term (F' text' termRef' typeRef' termLink' typeLink' vt') v a Source #
extraMapM :: forall m text termRef typeRef termLink typeLink vt text' termRef' typeRef' termLink' typeLink' vt' v a. (Ord v, Ord vt', Monad m) => (text -> m text') -> (termRef -> m termRef') -> (typeRef -> m typeRef') -> (termLink -> m termLink') -> (typeLink -> m typeLink') -> (vt -> m vt') -> Term (F' text termRef typeRef termLink typeLink vt) v a -> m (Term (F' text' termRef' typeRef' termLink' typeLink' vt') v a) Source #
rmapPattern :: (t -> t') -> (r -> r') -> Pattern t r -> Pattern t' r' Source #
rmapPatternM :: Applicative m => (t -> m t') -> (r -> m r') -> Pattern t r -> m (Pattern t' r') Source #
dependencies :: (Ord termRef, Ord typeRef, Ord termLink, Ord typeLink, Ord v) => Term (F' text termRef typeRef termLink typeLink vt) v a -> (Set termRef, Set typeRef, Set termLink, Set typeLink) Source #
:: forall v extra. Var v | |
=> Hash | The hash of the component, this is used to fill in self-references. |
-> (Id -> v) | A function to convert a reference to a variable. The actual var names aren't important. |
-> Map Id (Term v, extra) | |
-> Map Id (v, HashableTerm v, extra) | The component with all self-references replaced with variable references. |
Given the pieces of a single term component,
replaces all Nothing
self-referential hashes with a variable reference
to the relevant piece of the component in the component map.