unison-share-api-0.0.0
Safe HaskellSafe-Inferred
LanguageHaskell2010

Unison.Server.Backend

Synopsis

Types

newtype Backend m a Source #

Instances

Instances details
MonadTrans Backend Source # 
Instance details

Defined in Unison.Server.Backend

Methods

lift :: Monad m => m a -> Backend m a #

Monad m => MonadError BackendError (Backend m) Source # 
Instance details

Defined in Unison.Server.Backend

Methods

throwError :: BackendError -> Backend m a #

catchError :: Backend m a -> (BackendError -> Backend m a) -> Backend m a #

Monad m => MonadReader BackendEnv (Backend m) Source # 
Instance details

Defined in Unison.Server.Backend

Methods

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

Defined in Unison.Server.Backend

Methods

liftIO :: IO a -> Backend m a #

Monad m => Applicative (Backend m) Source # 
Instance details

Defined in Unison.Server.Backend

Methods

pure :: a -> Backend m a #

(<*>) :: Backend m (a -> b) -> Backend m a -> Backend m b #

liftA2 :: (a -> b -> c) -> Backend m a -> Backend m b -> Backend m c #

(*>) :: Backend m a -> Backend m b -> Backend m b #

(<*) :: Backend m a -> Backend m b -> Backend m a #

Functor m => Functor (Backend m) Source # 
Instance details

Defined in Unison.Server.Backend

Methods

fmap :: (a -> b) -> Backend m a -> Backend m b #

(<$) :: a -> Backend m b -> Backend m a #

Monad m => Monad (Backend m) Source # 
Instance details

Defined in Unison.Server.Backend

Methods

(>>=) :: Backend m a -> (a -> Backend m b) -> Backend m b #

(>>) :: Backend m a -> Backend m b -> Backend m b #

return :: a -> Backend m a #

data ShallowListEntry v a Source #

Instances

Instances details
Generic (ShallowListEntry v a) Source # 
Instance details

Defined in Unison.Server.Backend

Associated Types

type Rep (ShallowListEntry v a) :: Type -> Type #

Show v => Show (ShallowListEntry v a) Source # 
Instance details

Defined in Unison.Server.Backend

Var v => Eq (ShallowListEntry v a) Source # 
Instance details

Defined in Unison.Server.Backend

Var v => Ord (ShallowListEntry v a) Source # 
Instance details

Defined in Unison.Server.Backend

type Rep (ShallowListEntry v a) Source # 
Instance details

Defined in Unison.Server.Backend

newtype BackendEnv Source #

Constructors

BackendEnv 

Fields

  • useNamesIndex :: Bool

    Whether to use the sqlite name-lookup table to generate Names objects rather than building Names from the root branch.

Instances

Instances details
Monad m => MonadReader BackendEnv (Backend m) Source # 
Instance details

Defined in Unison.Server.Backend

Methods

ask :: Backend m BackendEnv #

local :: (BackendEnv -> BackendEnv) -> Backend m a -> Backend m a #

reader :: (BackendEnv -> a) -> Backend m a #

data TermEntry v a Source #

Instances

Instances details
Generic (TermEntry v a) Source # 
Instance details

Defined in Unison.Server.Backend

Associated Types

type Rep (TermEntry v a) :: Type -> Type #

Methods

from :: TermEntry v a -> Rep (TermEntry v a) x #

to :: Rep (TermEntry v a) x -> TermEntry v a #

Show v => Show (TermEntry v a) Source # 
Instance details

Defined in Unison.Server.Backend

Methods

showsPrec :: Int -> TermEntry v a -> ShowS #

show :: TermEntry v a -> String #

showList :: [TermEntry v a] -> ShowS #

Var v => Eq (TermEntry v a) Source # 
Instance details

Defined in Unison.Server.Backend

Methods

(==) :: TermEntry v a -> TermEntry v a -> Bool #

(/=) :: TermEntry v a -> TermEntry v a -> Bool #

Var v => Ord (TermEntry v a) Source # 
Instance details

Defined in Unison.Server.Backend

Methods

compare :: TermEntry v a -> TermEntry v a -> Ordering #

(<) :: TermEntry v a -> TermEntry v a -> Bool #

(<=) :: TermEntry v a -> TermEntry v a -> Bool #

(>) :: TermEntry v a -> TermEntry v a -> Bool #

(>=) :: TermEntry v a -> TermEntry v a -> Bool #

max :: TermEntry v a -> TermEntry v a -> TermEntry v a #

min :: TermEntry v a -> TermEntry v a -> TermEntry v a #

type Rep (TermEntry v a) Source # 
Instance details

Defined in Unison.Server.Backend

type Rep (TermEntry v a) = D1 ('MetaData "TermEntry" "Unison.Server.Backend" "unison-share-api-0.0.0-7lCnmLo0h1RCAMi07EAZKZ" 'False) (C1 ('MetaCons "TermEntry" 'PrefixI 'True) ((S1 ('MetaSel ('Just "termEntryReferent") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Referent) :*: (S1 ('MetaSel ('Just "termEntryHash") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ShortHash) :*: S1 ('MetaSel ('Just "termEntryName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Name))) :*: (S1 ('MetaSel ('Just "termEntryConflicted") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: (S1 ('MetaSel ('Just "termEntryType") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (Type v a))) :*: S1 ('MetaSel ('Just "termEntryTag") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TermTag)))))

data TypeEntry Source #

Instances

Instances details
Generic TypeEntry Source # 
Instance details

Defined in Unison.Server.Backend

Associated Types

type Rep TypeEntry :: Type -> Type #

Show TypeEntry Source # 
Instance details

Defined in Unison.Server.Backend

Eq TypeEntry Source # 
Instance details

Defined in Unison.Server.Backend

Ord TypeEntry Source # 
Instance details

Defined in Unison.Server.Backend

type Rep TypeEntry Source # 
Instance details

Defined in Unison.Server.Backend

type Rep TypeEntry = D1 ('MetaData "TypeEntry" "Unison.Server.Backend" "unison-share-api-0.0.0-7lCnmLo0h1RCAMi07EAZKZ" '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)))))

data FoundRef Source #

Instances

Instances details
Generic FoundRef Source # 
Instance details

Defined in Unison.Server.Backend

Associated Types

type Rep FoundRef :: Type -> Type #

Methods

from :: FoundRef -> Rep FoundRef x #

to :: Rep FoundRef x -> FoundRef #

Show FoundRef Source # 
Instance details

Defined in Unison.Server.Backend

Eq FoundRef Source # 
Instance details

Defined in Unison.Server.Backend

Ord FoundRef Source # 
Instance details

Defined in Unison.Server.Backend

type Rep FoundRef Source # 
Instance details

Defined in Unison.Server.Backend

type Rep FoundRef = D1 ('MetaData "FoundRef" "Unison.Server.Backend" "unison-share-api-0.0.0-7lCnmLo0h1RCAMi07EAZKZ" '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

Endpoints

Utilities

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 #

hoistBackend :: (forall x. m x -> n x) -> Backend m a -> Backend n a 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,

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.

termReferentsByShortHash :: Codebase m v a -> ShortHash -> Transaction (Set Referent) Source #

Look up terms in the codebase by short hash, and include builtins.

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

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'.

Unused, could remove?

isTestResultList :: forall v a. (Var v, Monoid a) => Maybe (Type v a) -> Bool 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.