HepLean Documentation

Lake.Build.Trace

Lake Traces #

This module defines Lake traces and associated utilities. Traces are used to determine whether a Lake build artifact is dirty (needs to be rebuilt) or is already up-to-date. The primary type is Lake.BuildTrace.

Utilities #

class Lake.CheckExists (i : Type u) :
  • checkExists : iBaseIO Bool

    Check whether there already exists an artifact for the given target info.

Instances

    Trace Abstraction #

    class Lake.ComputeTrace (α : Type u) (m : outParam (Type v → Type w)) (τ : Type v) :
    Type (max u w)
    • computeTrace : αm τ

      Compute the trace of an object in its preferred monad.

    Instances
      @[inline]
      def Lake.computeTrace {α : Type u_1} {m : Type u_2 → Type u_3} {τ : Type u_2} {n : Type u_2 → Type u_4} [Lake.ComputeTrace α m τ] [MonadLiftT m n] (a : α) :
      n τ

      Compute the trace of an object in a supporting monad.

      Equations
      Instances For
        class Lake.NilTrace (α : Type u) :
        • nilTrace : α

          The nil trace. Should not unduly clash with a proper trace.

        Instances
          Equations
          • Lake.inhabitedOfNilTrace = { default := Lake.nilTrace }
          class Lake.MixTrace (α : Type u) :
          • mixTrace : ααα

            Combine two traces. The result should be dirty if either of the inputs is dirty.

          Instances
            def Lake.mixTraceList {τ : Type u_1} [Lake.MixTrace τ] [Lake.NilTrace τ] (traces : List τ) :
            τ
            Equations
            Instances For
              def Lake.mixTraceArray {τ : Type u_1} [Lake.MixTrace τ] [Lake.NilTrace τ] (traces : Array τ) :
              τ
              Equations
              Instances For
                @[inline]
                def Lake.computeListTrace {τ : Type u_1} {α : Type u_2} {m : Type u_1 → Type u_3} [Lake.MixTrace τ] [Lake.NilTrace τ] [Lake.ComputeTrace α m τ] {n : Type u_1 → Type u_4} [MonadLiftT m n] [Monad n] (as : List α) :
                n τ
                Equations
                Instances For
                  instance Lake.instComputeTraceListOfMonad {τ : Type u_1} {α : Type u_2} {m : Type u_1 → Type u_3} [Lake.MixTrace τ] [Lake.NilTrace τ] [Lake.ComputeTrace α m τ] [Monad m] :
                  Equations
                  • Lake.instComputeTraceListOfMonad = { computeTrace := Lake.computeListTrace }
                  @[inline]
                  def Lake.computeArrayTrace {τ : Type u_1} {α : Type u_2} {m : Type u_1 → Type u_3} [Lake.MixTrace τ] [Lake.NilTrace τ] [Lake.ComputeTrace α m τ] {n : Type u_1 → Type u_4} [MonadLiftT m n] [Monad n] (as : Array α) :
                  n τ
                  Equations
                  Instances For
                    instance Lake.instComputeTraceArrayOfMonad {τ : Type u_1} {α : Type u_2} {m : Type u_1 → Type u_3} [Lake.MixTrace τ] [Lake.NilTrace τ] [Lake.ComputeTrace α m τ] [Monad m] :
                    Equations
                    • Lake.instComputeTraceArrayOfMonad = { computeTrace := Lake.computeArrayTrace }

                    Hash Trace #

                    structure Lake.Hash :

                    A content hash.

                    Instances For
                      @[inline]
                      Equations
                      Instances For
                        Equations
                        Instances For
                          @[inline]
                          Equations
                          • h1.mix h2 = { val := mixHash h1.val h2.val }
                          Instances For
                            @[inline]
                            Equations
                            Instances For
                              @[inline]
                              Equations
                              Instances For
                                @[inline]
                                Equations
                                Instances For
                                  @[inline]
                                  Equations
                                  Instances For
                                    @[inline]
                                    Equations
                                    Instances For
                                      class Lake.ComputeHash (α : Type u) (m : outParam (TypeType v)) :
                                      Type (max u v)
                                      • computeHash : αm Lake.Hash

                                        Compute the hash of an object in its preferred monad.

                                      Instances
                                        Equations
                                        • Lake.instComputeTraceHashOfComputeHash = { computeTrace := Lake.ComputeHash.computeHash }
                                        @[inline]
                                        def Lake.pureHash {α : Type u_1} [Lake.ComputeHash α Id] (a : α) :

                                        Compute the hash of object a in a pure context.

                                        Equations
                                        Instances For
                                          @[inline]
                                          def Lake.computeHash {α : Type u_1} {m : TypeType u_2} {n : TypeType u_3} [Lake.ComputeHash α m] [MonadLiftT m n] (a : α) :

                                          Compute the hash an object in an supporting monad.

                                          Equations
                                          Instances For

                                            Compute the hash of a binary file. Binary files are equivalent only if they are byte identical.

                                            Equations
                                            Instances For

                                              Compute the hash of a text file. Normalizes \r\n sequences to \n for cross-platform compatibility.

                                              Equations
                                              Instances For

                                                A wrapper around FilePath that adjusts its ComputeHash implementation to normalize \r\n sequences to \n for cross-platform compatibility.

                                                Instances For
                                                  @[inline]

                                                  Compute the hash of a file. If text := true, normalize line endings.

                                                  Equations
                                                  Instances For
                                                    @[inline]
                                                    def Lake.computeArrayHash {α : Type u_1} {m : TypeType u_2} [Lake.ComputeHash α m] [Monad m] (as : Array α) :

                                                    Compute the hash of each element of an array and combine them (left-to-right).

                                                    Equations
                                                    Instances For
                                                      instance Lake.instComputeHashArrayOfMonad {α : Type u_1} {m : TypeType u_2} [Lake.ComputeHash α m] [Monad m] :
                                                      Equations
                                                      • Lake.instComputeHashArrayOfMonad = { computeHash := Lake.computeArrayHash }

                                                      Modification Time (MTime) Trace #

                                                      A modification time (e.g., of a file).

                                                      Equations
                                                      Instances For
                                                        Equations
                                                        class Lake.GetMTime (α : Type u) :
                                                        • getMTime : αIO Lake.MTime

                                                          Return the modification time of an object.

                                                        Instances
                                                          Equations
                                                          • Lake.instComputeTraceIOMTimeOfGetMTime = { computeTrace := Lake.getMTime }
                                                          @[inline]

                                                          Return the modification time of a file recorded by the OS.

                                                          Equations
                                                          Instances For
                                                            @[specialize #[]]
                                                            def Lake.MTime.checkUpToDate {i : Type u_1} [Lake.GetMTime i] (info : i) (self : Lake.MTime) :

                                                            Check if info is up-to-date using modification time. That is, check if the info is newer than self.

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

                                                              Lake Build Trace #

                                                              Trace used for common Lake targets. Combines Hash and MTime.

                                                              Instances For
                                                                @[inline]
                                                                Equations
                                                                Instances For
                                                                  @[inline]
                                                                  Equations
                                                                  Instances For
                                                                    Equations
                                                                    Instances For
                                                                      @[specialize #[]]
                                                                      def Lake.BuildTrace.compute {α : Type u_1} {m : TypeType u_2} [Lake.ComputeHash α m] [MonadLiftT m IO] [Lake.GetMTime α] (info : α) :
                                                                      Equations
                                                                      Instances For
                                                                        Equations
                                                                        • Lake.BuildTrace.instComputeTraceIOOfComputeHashOfMonadLiftTOfGetMTime = { computeTrace := Lake.BuildTrace.compute }
                                                                        Equations
                                                                        • t1.mix t2 = { hash := t1.hash.mix t2.hash, mtime := max t1.mtime t2.mtime }
                                                                        Instances For
                                                                          @[specialize #[]]

                                                                          Check if the info is up-to-date using a hash. That is, check that info exists and its input hash matches this trace's hash.

                                                                          Equations
                                                                          Instances For
                                                                            @[inline]

                                                                            Check if the info is up-to-date using modification time. That is, check if the info is newer than this input trace's modification time.

                                                                            Equations
                                                                            Instances For
                                                                              @[specialize #[], deprecated]

                                                                              Check if the info is up-to-date using a trace file. If the file exists, match its hash to this trace's hash. If not, check if the info is newer than this trace's modification time.

                                                                              Deprecated: Should not be done manually, but as part of buildUnlessUpToDate.

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

                                                                                Write trace to a file.

                                                                                Deprecated: Should not be done manually, but as part of buildUnlessUpToDate.

                                                                                Equations
                                                                                Instances For