File: .lake/packages/lean4/src/lean/lake/Lake/Load/Resolve.lean

full_name: Lake.loadDepPackage
code: /--
Loads the package configuration of a materialized dependency.
Adds the facets defined in the package to the `Workspace`.
-/
def loadDepPackage
  (dep : MaterializedDep)
  (lakeOpts : NameMap String)
  (leanOpts : Options) (reconfigure : Bool)
: StateT Workspace LogIO Package 
goal: StateT Lake.Workspace Lake.LogIO Lake.Package

full_name: Lake.ResolveT
code: /-- The monad of the dependency resolver. -/
abbrev ResolveT m 
goal: Type u_1

full_name: Lake.ResolveT.run
code: @[inline] nonrec def ResolveT.run (ws : Workspace) (x : ResolveT m α) (stack : CallStack Name := {}) : m (α × Workspace) 
goal: m (α × Lake.Workspace)

full_name: Lake.depCycleError
code: /-- Log dependency cycle and error. -/
@[specialize] def depCycleError [MonadError m] (cycle : Cycle Name) : m α 
goal: m α

full_name: Lake.instMonadCycleOfNameResolveTOfMonadOfMonadError
code: instance [Monad m] [MonadError m] : MonadCycleOf Name (ResolveT m) 
goal: Lake.MonadCycleOf Lake.Name (Lake.ResolveT m)

full_name: Lake.Workspace.resolveDeps.go
code: /--
Recursively visits the workspace dependency graph, starting from `root`.
At each package, loops through each direct dependency performing just `breath`.
Them, loops again through the results applying `depth`, recursing, and adding
the package to workspace's package set. Errors if a cycle is encountered.

**Traversal Order**

All dependencies of a package are visited in order before recursing to the
dependencies' dependencies. For example, given the dependency graph:

```
R
|- A
|- B
 |- X
 |- Y
|- C
```

Lake follows the order `R`, `A`, `B`, `C`, `X`, `Y`.

The logic behind this design is that users would expect the dependencies
they write in a package configuration to be resolved accordingly and would be
surprised if they are overridden by nested dependencies referring to the same
package.

For example, were Lake to use a pure depth-first traversal, Lake would follow
the order `R`, `A`, `B`, `X`, `Y`, `C`. If `X` and `C` are both the package
`foo`, Lake would use the configuration of `foo` found in `B` rather than in
the root `R`, which would likely confuse the user.
-/
@[specialize] def Workspace.resolveDeps
  [Monad m] [MonadError m] (ws : Workspace)
  (breadth : Package → Dependency → ResolveT m Package)
  (depth : Package → m PUnit := fun _ => pure ())
: m Workspace 
goal: StateT (Lake.NameMap Lake.Package) (Lake.ResolveT m) Lake.Package

full_name: Lake.Workspace.resolveDeps
code: /--
Recursively visits the workspace dependency graph, starting from `root`.
At each package, loops through each direct dependency performing just `breath`.
Them, loops again through the results applying `depth`, recursing, and adding
the package to workspace's package set. Errors if a cycle is encountered.

**Traversal Order**

All dependencies of a package are visited in order before recursing to the
dependencies' dependencies. For example, given the dependency graph:

```
R
|- A
|- B
 |- X
 |- Y
|- C
```

Lake follows the order `R`, `A`, `B`, `C`, `X`, `Y`.

The logic behind this design is that users would expect the dependencies
they write in a package configuration to be resolved accordingly and would be
surprised if they are overridden by nested dependencies referring to the same
package.

For example, were Lake to use a pure depth-first traversal, Lake would follow
the order `R`, `A`, `B`, `X`, `Y`, `C`. If `X` and `C` are both the package
`foo`, Lake would use the configuration of `foo` found in `B` rather than in
the root `R`, which would likely confuse the user.
-/
@[specialize] def Workspace.resolveDeps
  [Monad m] [MonadError m] (ws : Workspace)
  (breadth : Package → Dependency → ResolveT m Package)
  (depth : Package → m PUnit := fun _ => pure ())
: m Workspace 
goal: m Lake.Workspace

full_name: Lake.stdMismatchError
code: def stdMismatchError (newName : String) (rev : String) 
goal: String

full_name: Lake.UpdateT
code: /--
The monad of the manifest updater.
It is equipped with and entry map entries for the updated manifest.
-/
abbrev UpdateT 
goal: Type u_1

full_name: Lake.UpdateT.run
code: @[inline] nonrec def UpdateT.run (x : UpdateT m α) (init : NameMap PackageEntry := {}) : m (α × NameMap PackageEntry) 
goal: m (α × Lake.NameMap Lake.PackageEntry)

full_name: Lake.reuseManifest
code: /--
Reuse manifest versions of root packages that should not be updated.
Also, move the packages directory if its location has changed.
-/
def reuseManifest (ws : Workspace) (toUpdate : NameSet) : UpdateT LogIO PUnit 
goal: Lake.UpdateT Lake.LogIO PUnit

full_name: Lake.addDependencyEntries
code: /-- Add a package dependency's manifest entries to the update state. -/
def addDependencyEntries (pkg : Package) : UpdateT LogIO PUnit 
goal: Lake.UpdateT Lake.LogIO PUnit

full_name: Lake.updateDep
code: /-- Update a single dependency. -/
def updateDep
  (pkg : Package) (dep : Dependency) (leanOpts : Options := {})
: ResolveT (UpdateT LogIO) Package 
goal: Lake.ResolveT (Lake.UpdateT Lake.LogIO) Lake.Package

full_name: Lake.Workspace.updateAndMaterialize
code: /--
Rebuild the workspace's Lake manifest and materialize missing dependencies.

Packages are updated to latest specific revision matching that in `require`
(e.g., if the `require` is `@master`, update to latest commit on master) or
removed if the `require` is removed. If `tuUpdate` is empty, update/remove all
root dependencies. Otherwise, only update the root dependencies specified.

Package are always reconfigured when updated.
-/
def Workspace.updateAndMaterialize
  (ws : Workspace) (toUpdate : NameSet := {}) (leanOpts : Options := {})
: LogIO Workspace 
goal: Lake.LogIO Lake.Workspace

full_name: Lake.validateManifest
code: /--
Check whether the manifest exists and
whether entries in the manifest are up-to-date,
reporting warnings and/or errors as appropriate.
-/
def validateManifest
  (pkgEntries : NameMap PackageEntry) (deps : Array Dependency)
: LogIO PUnit 
goal: Lake.LogIO PUnit

full_name: Lake.Workspace.materializeDeps
code: /--
Resolving a workspace's dependencies using a manifest,
downloading and/or updating them as necessary.
-/
def Workspace.materializeDeps
  (ws : Workspace) (manifest : Manifest)
  (leanOpts : Options := {}) (reconfigure := false)
: LogIO Workspace 
goal: Lake.LogIO Lake.Workspace