Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data BackendError
- = NoSuchNamespace Absolute
- | BadNamespace String String
- | CouldntExpandBranchHash ShortCausalHash
- | AmbiguousBranchHash ShortCausalHash (Set ShortCausalHash)
- | AmbiguousHashForDefinition ShortHash
- | NoBranchForHash CausalHash
- | CouldntLoadBranch CausalHash
- | MissingSignatureForTerm Reference
- | NoSuchDefinition (HashQualified Name)
- | ExpectedNameLookup BranchHash
- | DisjointProjectAndPerspective Path Path
- | ProjectBranchNameNotFound ProjectName ProjectBranchName
- newtype Backend m a = Backend {
- runBackend :: ReaderT BackendEnv (ExceptT BackendError m) a
- data ShallowListEntry v a
- listEntryName :: ShallowListEntry v a -> Text
- newtype BackendEnv = BackendEnv {}
- data TermEntry v a = TermEntry {}
- data TypeEntry = TypeEntry {}
- data FoundRef
- data IncludeCycles
- data DefinitionResults = DefinitionResults {
- termResults :: Map Reference (DisplayObject (Type Symbol Ann) (Term Symbol Ann))
- typeResults :: Map Reference (DisplayObject () (Decl Symbol Ann))
- noResults :: [HashQualified Name]
- type SyntaxText = SyntaxText' Reference
- fuzzyFind :: Names -> String -> [(Alignment, UnisonName, [FoundRef])]
- bestNameForTerm :: forall v. Var v => PrettyPrintEnv -> Width -> Referent -> Text
- bestNameForType :: forall v. Var v => PrettyPrintEnv -> Width -> Reference -> Text
- definitionsByName :: Codebase m Symbol Ann -> NameSearch Transaction -> IncludeCycles -> SearchType -> [HashQualified Name] -> Transaction DefinitionResults
- displayType :: Codebase m Symbol Ann -> Reference -> Transaction (DisplayObject () (Decl Symbol Ann))
- docsInBranchToHtmlFiles :: Runtime Symbol -> Codebase IO Symbol Ann -> Branch IO -> FilePath -> IO [Error]
- expandShortCausalHash :: ShortCausalHash -> Backend Transaction CausalHash
- findDocInBranch :: Set NameSegment -> Branch m -> Maybe TermReference
- formatSuffixedType :: Var v => PrettyPrintEnvDecl -> Width -> Type v Ann -> SyntaxText
- getShallowCausalAtPathFromRootHash :: CausalHash -> Path -> Transaction (CausalBranch Transaction)
- getTermTag :: (Var v, MonadIO m) => Codebase m v a -> Referent -> Maybe (Type v Ann) -> m TermTag
- getTypeTag :: Var v => Codebase m v Ann -> Reference -> Transaction TypeTag
- hoistBackend :: (forall x. m x -> n x) -> Backend m a -> Backend n a
- hqNameQuery :: Codebase m v Ann -> NameSearch Transaction -> SearchType -> [HashQualified Name] -> Transaction QueryResult
- loadReferentType :: Codebase m Symbol Ann -> Referent -> Transaction (Maybe (Type Symbol Ann))
- loadSearchResults :: Codebase m Symbol Ann -> [SearchResult] -> Transaction [SearchResult' Symbol Ann]
- lsAtPath :: MonadIO m => Codebase m Symbol Ann -> Branch Transaction -> Absolute -> m [ShallowListEntry Symbol Ann]
- lsBranch :: MonadIO m => Codebase m Symbol Ann -> Branch n -> m [ShallowListEntry Symbol Ann]
- mungeSyntaxText :: Functor g => g (Element Reference) -> g Element
- expectCausalBranchByCausalHash :: CausalHash -> Transaction (CausalBranch Transaction)
- resolveRootBranchHashV2 :: ShortCausalHash -> Backend Transaction (CausalBranch Transaction)
- namesAtPathFromRootBranchHash :: forall m n v a. MonadIO m => Codebase m v a -> CausalBranch n -> Path -> Backend m (Names, PrettyPrintEnvDecl)
- termEntryDisplayName :: TermEntry v a -> Text
- termEntryHQName :: TermEntry v a -> HashQualified Name
- termEntryToNamedTerm :: Var v => PrettyPrintEnv -> Maybe Width -> TermEntry v a -> NamedTerm
- termEntryLabeledDependencies :: Ord v => TermEntry v a -> Set LabeledDependency
- termListEntry :: MonadIO m => Codebase m Symbol Ann -> ExactName Name Referent -> m (TermEntry Symbol Ann)
- termReferentsByShortHash :: Codebase m v a -> ShortHash -> Transaction (Set Referent)
- typeDeclHeader :: forall v m. Var v => Codebase m v Ann -> PrettyPrintEnv -> Reference -> Transaction (DisplayObject SyntaxText SyntaxText)
- typeEntryDisplayName :: TypeEntry -> Text
- typeEntryHQName :: TypeEntry -> HashQualified Name
- typeEntryToNamedType :: TypeEntry -> NamedType
- typeEntryLabeledDependencies :: TypeEntry -> Set LabeledDependency
- typeListEntry :: Var v => Codebase m v Ann -> ExactName Name Reference -> Transaction TypeEntry
- typeReferencesByShortHash :: ShortHash -> Transaction (Set Reference)
- typeToSyntaxHeader :: Width -> HashQualified Name -> DisplayObject () (Decl Symbol Ann) -> DisplayObject SyntaxText SyntaxText
- renderDocRefs :: Traversable t => PrettyPrintEnvDecl -> Width -> Codebase IO Symbol Ann -> Runtime Symbol -> t TermReference -> IO (t (HashQualifiedName, UnisonHash, Doc, [Error]))
- docsForDefinitionName :: Codebase IO Symbol Ann -> NameSearch Transaction -> SearchType -> Name -> Transaction [TermReference]
- normaliseRootCausalHash :: Either ShortCausalHash CausalHash -> Backend Transaction (CausalBranch Transaction)
- resolveRootBranchHash :: MonadIO m => ShortCausalHash -> Codebase m v a -> Backend m (Branch m)
- isTestResultList :: forall v a. (Var v, Monoid a) => Maybe (Type v a) -> Bool
- fixupNamesRelative :: Absolute -> Names -> Names
- termsToSyntax :: Var v => Ord a => Suffixify -> Width -> PrettyPrintEnvDecl -> [(TermReference, DisplayObject (Type v a) (Term v a))] -> [(TermReference, DisplayObject SyntaxText SyntaxText)]
- termsToSyntaxOf :: Var v => Ord a => Suffixify -> Width -> PrettyPrintEnvDecl -> Traversal s t (TermReference, DisplayObject (Type v a) (Term v a)) (TermReference, DisplayObject SyntaxText SyntaxText) -> s -> t
- typesToSyntax :: Var v => Ord a => Suffixify -> Width -> PrettyPrintEnvDecl -> [(TypeReference, DisplayObject () (Decl v a))] -> [(TypeReference, DisplayObject SyntaxText SyntaxText)]
- typesToSyntaxOf :: Var v => Ord a => Suffixify -> Width -> PrettyPrintEnvDecl -> Traversal s t (TypeReference, DisplayObject () (Decl v a)) (TypeReference, DisplayObject SyntaxText SyntaxText) -> s -> t
- definitionResultsDependencies :: DefinitionResults -> Set LabeledDependency
- evalDocRef :: Runtime Symbol -> Codebase IO Symbol Ann -> TermReference -> IO (EvaluatedDoc Symbol, [Error])
- mkTermDefinition :: Codebase IO Symbol Ann -> PrettyPrintEnvDecl -> Width -> Reference -> [(HashQualifiedName, UnisonHash, Doc)] -> DisplayObject (AnnotatedText (Element Reference)) (AnnotatedText (Element Reference)) -> Backend IO TermDefinition
- mkTypeDefinition :: MonadIO m => Codebase IO Symbol Ann -> PrettyPrintEnvDecl -> Width -> Reference -> [(HashQualifiedName, UnisonHash, Doc)] -> DisplayObject (AnnotatedText (Element Reference)) (AnnotatedText (Element Reference)) -> m TypeDefinition
- displayTerm :: Codebase m Symbol Ann -> Reference -> Transaction (DisplayObject (Type Symbol Ann) (Term Symbol Ann))
- formatTypeName :: PrettyPrintEnv -> Reference -> SyntaxText
Types
data BackendError Source #
Instances
Show BackendError Source # | |
Defined in Unison.Server.Backend showsPrec :: Int -> BackendError -> ShowS # show :: BackendError -> String # showList :: [BackendError] -> ShowS # | |
Monad m => MonadError BackendError (Backend m) Source # | |
Defined in Unison.Server.Backend throwError :: BackendError -> Backend m a # catchError :: Backend m a -> (BackendError -> Backend m a) -> Backend m a # |
Backend | |
|
Instances
MonadTrans Backend Source # | |
Defined in Unison.Server.Backend | |
Monad m => MonadError BackendError (Backend m) Source # | |
Defined in Unison.Server.Backend throwError :: BackendError -> Backend m a # catchError :: Backend m a -> (BackendError -> Backend m a) -> Backend m a # | |
Monad m => MonadReader BackendEnv (Backend m) Source # | |
Defined in Unison.Server.Backend ask :: Backend m BackendEnv # local :: (BackendEnv -> BackendEnv) -> Backend m a -> Backend m a # reader :: (BackendEnv -> a) -> Backend m a # | |
MonadIO m => MonadIO (Backend m) Source # | |
Defined in Unison.Server.Backend | |
Monad m => Applicative (Backend m) Source # | |
Functor m => Functor (Backend m) Source # | |
Monad m => Monad (Backend m) Source # | |
data ShallowListEntry v a Source #
ShallowTermEntry (TermEntry v a) | |
ShallowTypeEntry TypeEntry | |
ShallowBranchEntry NameSegment CausalHash NamespaceStats | |
ShallowPatchEntry NameSegment |
Instances
listEntryName :: ShallowListEntry v a -> Text Source #
newtype BackendEnv Source #
BackendEnv | |
|
Instances
Monad m => MonadReader BackendEnv (Backend m) Source # | |
Defined in Unison.Server.Backend ask :: Backend m BackendEnv # local :: (BackendEnv -> BackendEnv) -> Backend m a -> Backend m a # reader :: (BackendEnv -> a) -> Backend m a # |
TermEntry | |
|
Instances
Instances
Generic TypeEntry Source # | |
Show TypeEntry Source # | |
Eq TypeEntry Source # | |
Ord TypeEntry Source # | |
Defined in Unison.Server.Backend | |
type Rep TypeEntry Source # | |
Defined in Unison.Server.Backend type Rep TypeEntry = D1 ('MetaData "TypeEntry" "Unison.Server.Backend" "unison-share-api-0.0.0-C8EhduMcnIVLJzlEB6yMhH" 'False) (C1 ('MetaCons "TypeEntry" 'PrefixI 'True) ((S1 ('MetaSel ('Just "typeEntryReference") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Reference) :*: S1 ('MetaSel ('Just "typeEntryHash") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ShortHash)) :*: (S1 ('MetaSel ('Just "typeEntryName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Name) :*: (S1 ('MetaSel ('Just "typeEntryConflicted") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: S1 ('MetaSel ('Just "typeEntryTag") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TypeTag))))) |
Instances
Generic FoundRef Source # | |
Show FoundRef Source # | |
Eq FoundRef Source # | |
Ord FoundRef Source # | |
Defined in Unison.Server.Backend | |
type Rep FoundRef Source # | |
Defined in Unison.Server.Backend type Rep FoundRef = D1 ('MetaData "FoundRef" "Unison.Server.Backend" "unison-share-api-0.0.0-C8EhduMcnIVLJzlEB6yMhH" 'False) (C1 ('MetaCons "FoundTermRef" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Referent)) :+: C1 ('MetaCons "FoundTypeRef" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Reference))) |
data IncludeCycles Source #
Determines whether we include full cycles in the results, (e.g. if I search for isEven
, will I find isOdd
too?)
This was once used for both term and decl components, but now is only used for decl components, because update
does
The Right Thing for terms (i.e. propagates changes to all dependents, including component-mates, which are de facto
dependents).
Ticket of interest: https://github.com/unisonweb/unison/issues/3445
data DefinitionResults Source #
DefinitionResults | |
|
Instances
Show DefinitionResults Source # | |
Defined in Unison.Server.Backend showsPrec :: Int -> DefinitionResults -> ShowS # show :: DefinitionResults -> String # showList :: [DefinitionResults] -> ShowS # |
type SyntaxText = SyntaxText' Reference Source #
Endpoints
Utilities
bestNameForTerm :: forall v. Var v => PrettyPrintEnv -> Width -> Referent -> Text Source #
bestNameForType :: forall v. Var v => PrettyPrintEnv -> Width -> Reference -> Text Source #
definitionsByName :: Codebase m Symbol Ann -> NameSearch Transaction -> IncludeCycles -> SearchType -> [HashQualified Name] -> Transaction DefinitionResults Source #
displayType :: Codebase m Symbol Ann -> Reference -> Transaction (DisplayObject () (Decl Symbol Ann)) Source #
docsInBranchToHtmlFiles :: Runtime Symbol -> Codebase IO Symbol Ann -> Branch IO -> FilePath -> IO [Error] Source #
findDocInBranch :: Set NameSegment -> Branch m -> Maybe TermReference Source #
formatSuffixedType :: Var v => PrettyPrintEnvDecl -> Width -> Type v Ann -> SyntaxText Source #
getShallowCausalAtPathFromRootHash :: CausalHash -> Path -> Transaction (CausalBranch Transaction) Source #
Efficiently resolve a root hash and path to a shallow branch's causal.
getTermTag :: (Var v, MonadIO m) => Codebase m v a -> Referent -> Maybe (Type v Ann) -> m TermTag Source #
getTypeTag :: Var v => Codebase m v Ann -> Reference -> Transaction TypeTag Source #
hoistBackend :: (forall x. m x -> n x) -> Backend m a -> Backend n a Source #
hqNameQuery :: Codebase m v Ann -> NameSearch Transaction -> SearchType -> [HashQualified Name] -> Transaction QueryResult Source #
loadReferentType :: Codebase m Symbol Ann -> Referent -> Transaction (Maybe (Type Symbol Ann)) Source #
loadSearchResults :: Codebase m Symbol Ann -> [SearchResult] -> Transaction [SearchResult' Symbol Ann] Source #
lsAtPath :: MonadIO m => Codebase m Symbol Ann -> Branch Transaction -> Absolute -> m [ShallowListEntry Symbol Ann] Source #
lsBranch :: MonadIO m => Codebase m Symbol Ann -> Branch n -> m [ShallowListEntry Symbol Ann] Source #
Find all definitions and children reachable from the given Branch
,
resolveRootBranchHashV2 :: ShortCausalHash -> Backend Transaction (CausalBranch Transaction) Source #
namesAtPathFromRootBranchHash :: forall m n v a. MonadIO m => Codebase m v a -> CausalBranch n -> Path -> Backend m (Names, PrettyPrintEnvDecl) Source #
Gets the names and PPED for the branch at the provided path from the root branch for the provided branch hash.
termEntryDisplayName :: TermEntry v a -> Text Source #
termEntryHQName :: TermEntry v a -> HashQualified Name Source #
termEntryToNamedTerm :: Var v => PrettyPrintEnv -> Maybe Width -> TermEntry v a -> NamedTerm Source #
termEntryLabeledDependencies :: Ord v => TermEntry v a -> Set LabeledDependency Source #
termListEntry :: MonadIO m => Codebase m Symbol Ann -> ExactName Name Referent -> m (TermEntry Symbol Ann) Source #
termReferentsByShortHash :: Codebase m v a -> ShortHash -> Transaction (Set Referent) Source #
Look up terms in the codebase by short hash, and include builtins.
typeDeclHeader :: forall v m. Var v => Codebase m v Ann -> PrettyPrintEnv -> Reference -> Transaction (DisplayObject SyntaxText SyntaxText) Source #
typeEntryDisplayName :: TypeEntry -> Text Source #
typeListEntry :: Var v => Codebase m v Ann -> ExactName Name Reference -> Transaction TypeEntry Source #
typeReferencesByShortHash :: ShortHash -> Transaction (Set Reference) Source #
Look up types in the codebase by short hash, and include builtins.
typeToSyntaxHeader :: Width -> HashQualified Name -> DisplayObject () (Decl Symbol Ann) -> DisplayObject SyntaxText SyntaxText Source #
Renders a type to its decl header, e.g.
Effect:
unique ability Stream s
Data:
structural type Maybe a
renderDocRefs :: Traversable t => PrettyPrintEnvDecl -> Width -> Codebase IO Symbol Ann -> Runtime Symbol -> t TermReference -> IO (t (HashQualifiedName, UnisonHash, Doc, [Error])) Source #
Evaluate and render the given docs
docsForDefinitionName :: Codebase IO Symbol Ann -> NameSearch Transaction -> SearchType -> Name -> Transaction [TermReference] Source #
Fetch the docs associated with the given name. Returns all references with a Doc type which are at the name provided, or at 'name.doc'.
normaliseRootCausalHash :: Either ShortCausalHash CausalHash -> Backend Transaction (CausalBranch Transaction) Source #
Unused, could remove?
resolveRootBranchHash :: MonadIO m => ShortCausalHash -> Codebase m v a -> Backend m (Branch m) Source #
Re-exported for Share Server
termsToSyntax :: Var v => Ord a => Suffixify -> Width -> PrettyPrintEnvDecl -> [(TermReference, DisplayObject (Type v a) (Term v a))] -> [(TermReference, DisplayObject SyntaxText SyntaxText)] Source #
Converts Type Display Objects into Syntax Text.
termsToSyntaxOf :: Var v => Ord a => Suffixify -> Width -> PrettyPrintEnvDecl -> Traversal s t (TermReference, DisplayObject (Type v a) (Term v a)) (TermReference, DisplayObject SyntaxText SyntaxText) -> s -> t Source #
Version of termsToSyntax
which works over arbitrary traversals.
E.g. @@ termsToSyntaxOf suff width pped traversed [(ref, dispObj)]
or
termsToSyntaxOf suff width pped id (ref, dispObj)
or
termsToSyntaxOf suff width pped Map.asList_ (Map.singleton ref dispObj)
@@
e.g. traversed
typesToSyntax :: Var v => Ord a => Suffixify -> Width -> PrettyPrintEnvDecl -> [(TypeReference, DisplayObject () (Decl v a))] -> [(TypeReference, DisplayObject SyntaxText SyntaxText)] Source #
Converts Type Display Objects into Syntax Text.
typesToSyntaxOf :: Var v => Ord a => Suffixify -> Width -> PrettyPrintEnvDecl -> Traversal s t (TypeReference, DisplayObject () (Decl v a)) (TypeReference, DisplayObject SyntaxText SyntaxText) -> s -> t Source #
Version of typesToSyntax
which works over arbitrary traversals.
E.g. @@ typesToSyntaxOf suff width pped traversed [(ref, dispObj)]
or
typesToSyntaxOf suff width pped id (ref, dispObj)
or
typesToSyntaxOf suff width pped Map.asList_ (Map.singleton ref dispObj) @@
definitionResultsDependencies :: DefinitionResults -> Set LabeledDependency Source #
Finds ALL direct references contained within a DefinitionResults
so we can
build a pretty printer for them.
evalDocRef :: Runtime Symbol -> Codebase IO Symbol Ann -> TermReference -> IO (EvaluatedDoc Symbol, [Error]) Source #
Evaluate the doc at the given reference and return its evaluated-but-not-rendered form.
mkTermDefinition :: Codebase IO Symbol Ann -> PrettyPrintEnvDecl -> Width -> Reference -> [(HashQualifiedName, UnisonHash, Doc)] -> DisplayObject (AnnotatedText (Element Reference)) (AnnotatedText (Element Reference)) -> Backend IO TermDefinition Source #
mkTypeDefinition :: MonadIO m => Codebase IO Symbol Ann -> PrettyPrintEnvDecl -> Width -> Reference -> [(HashQualifiedName, UnisonHash, Doc)] -> DisplayObject (AnnotatedText (Element Reference)) (AnnotatedText (Element Reference)) -> m TypeDefinition Source #
displayTerm :: Codebase m Symbol Ann -> Reference -> Transaction (DisplayObject (Type Symbol Ann) (Term Symbol Ann)) Source #
formatTypeName :: PrettyPrintEnv -> Reference -> SyntaxText Source #