Documentation

ImportGraph.Util.Modules

Module traversal utilities #

Provides directory and glob iteration, plus the JSON and hashing instances used by workspace summaries, without importing Lake workspace configuration or loading.

Allows iteration over the modules (any *.lean file) under dir via for (mod, dirEntry) in mods do. Usually invoked via for (mod, dirEntry) in dir.modules do; see ImportGraph.System.FilePath.modules for details.

Instances For
    @[inline]

    Allows iteration over the modules (any *.lean file) under dir via for (mod, dirEntry) in dir.modules do, descending into subdirectories (top-down, left-to-right), and constructing the module name according to the directory names and *.lean filenames.

    For example, if dir contains A/B/C.lean, this iteration visits (A.B.C, ⟨"A/B", "C.lean"⟩).

    If root is provided, then root is prepended to the module names created from paths in the directory, e.g. if dir contains A/B/C.lean and we iterate through for (mod, dirEntry) in dir.modules (root := `Foo), this iteration visits (Foo.A.B.C, ⟨"A/B", "C.lean"⟩).

    By default, no root is inferred.

    Equations
    Instances For
      @[specialize #[]]
      partial def ImportGraph.System.FilePath.Modules.forInAux {m : Type → Type u_1} [Monad m] [MonadLiftT IO m] {β : Type} (dir : System.FilePath) (pre : Lean.Name) (b : β) (f : Lean.Name × IO.FS.DirEntry → β → m (ForInStep β)) :
      m (ForInStep β)
      @[instance_reducible]
      Equations
      • One or more equations did not get rendered due to their size.

      Splits path into the DirEntry for its enclosing directory and file name, as readDir would report it. path.parent (rather than path.withFileName "") is used for root so that it carries no trailing separator and so that root / fileName round-trips back to path (matching the entries produced when iterating through a directory).

      Equations
      Instances For

        Missing instances #

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For

          for ... in instances #

          Allows iteration over the matched modules via for (mod, dirEntry) in globMods do. This is typically constructed via glob.modulesIn dir.

          Instances For
            @[inline]

            Allows iteration over the modules matched by a Lake.Glob in dir via for (mod, dirEntry) in glob.modulesIn dir do.

            Equations
            Instances For
              @[specialize #[]]
              def ImportGraph.Lake.Glob.Modules.forIn {m : Type → Type u_1} [Monad m] [MonadLiftT IO m] {β : Type} (spec : Modules) (init : β) (f : Lean.Name × IO.FS.DirEntry → β → m (ForInStep β)) :
              m β

              Iterates over the module names selected by glob, resolving submodule globs against the .lean files found under dir.

              Auxiliary to the ForIn instance for Glob.Modules.

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For