Utilities #
Equations
- Lake.instCheckExistsFilePath = { checkExists := System.FilePath.pathExists }
Trace Abstraction #
Equations
- Lake.computeTrace info = liftM (Lake.ComputeTrace.computeTrace info)
Instances For
- nilTrace : t
The nil trace. Should not unduly clash with a proper trace.
Instances
Equations
- Lake.instInhabited = { default := Lake.nilTrace }
- mixTrace : t → t → t
Combine two traces. The result should be dirty if either of the inputs is dirty.
Instances
Equations
- Lake.mixTraceList traces = List.foldl Lake.mixTrace Lake.nilTrace traces
Instances For
Equations
- Lake.mixTraceArray traces = Array.foldl Lake.mixTrace Lake.nilTrace traces 0 (Array.size traces)
Instances For
Equations
- Lake.computeListTrace artifacts = List.foldlM (fun ts t => do let __do_lift ← Lake.computeTrace t pure (Lake.mixTrace ts __do_lift)) Lake.nilTrace artifacts
Instances For
Equations
- Lake.instComputeTraceList = { computeTrace := Lake.computeListTrace }
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Lake.instComputeTraceArray = { computeTrace := Lake.computeArrayTrace }
Hash Trace #
Equations
Equations
- Lake.instReprHash = { reprPrec := Lake.reprHash✝ }
Equations
- Lake.Hash.load? hashFile = EIO.catchExceptions ((fun x => Option.map Lake.Hash.ofNat (String.toNat? x)) <$> IO.FS.readFile hashFile) fun x => pure none
Instances For
Equations
- Lake.Hash.instNilTraceHash = { nilTrace := Lake.Hash.nil }
Equations
- Lake.Hash.instMixTraceHash = { mixTrace := Lake.Hash.mix }
Equations
- Lake.Hash.instToStringHash = { toString := Lake.Hash.toString }
Equations
- Lake.Hash.ofString str = Lake.Hash.mix Lake.Hash.nil { val := hash str }
Instances For
Equations
- Lake.instComputeTraceHash = { computeTrace := Lake.ComputeHash.computeHash }
Equations
Instances For
Equations
Instances For
Equations
- Lake.instComputeHashStringId = { computeHash := Lake.Hash.ofString }
Equations
Instances For
Equations
- Lake.instComputeHashFilePathIO = { computeHash := Lake.computeFileHash }
This is the same as String.replace text "\r\n" "\n"
, but more efficient.
Equations
- Lake.crlf2lf text = Lake.crlf2lf.go text "" 0 0
Instances For
Equations
- Lake.computeTextFileHash file = do let text ← IO.FS.readFile file let text : String := Lake.crlf2lf text pure (Lake.Hash.ofString text)
Instances For
- path : Lake.FilePath
A wrapper around FilePath
that adjusts its ComputeHash
implementation
to normalize \r\n
sequences to \n
for cross-platform compatibility.
Instances For
Equations
- Lake.instCoeTextFilePathFilePath = { coe := fun x => x.path }
Equations
- Lake.instComputeHashTextFilePathIO = { computeHash := fun file => Lake.computeTextFileHash file.path }
Equations
- Lake.computeArrayHash xs = Array.foldlM (fun h a => do let __do_lift ← Lake.computeHash a pure (Lake.Hash.mix h __do_lift)) Lake.Hash.nil xs 0 (Array.size xs)
Instances For
Equations
- Lake.instComputeHashArray = { computeHash := Lake.computeArrayHash }
Modification Time (MTime) Trace #
Equations
- Lake.MTime.instOfNatMTime = { ofNat := { sec := 0, nsec := 0 } }
Equations
Equations
Equations
Equations
- Lake.MTime.instNilTraceMTime = { nilTrace := 0 }
Equations
- Lake.MTime.instMixTraceMTime = { mixTrace := max }
Equations
- Lake.instComputeTraceIOMTime = { computeTrace := Lake.getMTime }
Equations
- Lake.getFileMTime file = do let __do_lift ← System.FilePath.metadata file pure __do_lift.modified
Instances For
Equations
- Lake.instGetMTimeFilePath = { getMTime := Lake.getFileMTime }
Equations
- Lake.instGetMTimeTextFilePath = { getMTime := fun x => Lake.getFileMTime x.path }
Lake Build Trace (Hash + MTIme) #
- hash : Lake.Hash
- mtime : Lake.MTime
Trace used for common Lake targets. Combines Hash
and MTime
.
Instances For
Equations
- Lake.instReprBuildTrace = { reprPrec := Lake.reprBuildTrace✝ }
Equations
Equations
- Lake.BuildTrace.ofMTime mtime = { hash := Lake.Hash.nil, mtime := mtime }
Instances For
Equations
Equations
- Lake.BuildTrace.nil = { hash := Lake.Hash.nil, mtime := 0 }
Instances For
Equations
- Lake.BuildTrace.instNilTraceBuildTrace = { nilTrace := Lake.BuildTrace.nil }
Equations
- Lake.BuildTrace.compute info = do let __do_lift ← Lake.computeHash info let __do_lift_1 ← Lake.getMTime info pure { hash := __do_lift, mtime := __do_lift_1 }
Instances For
Equations
- Lake.BuildTrace.instComputeTraceIOBuildTrace = { computeTrace := Lake.BuildTrace.compute }
Equations
- Lake.BuildTrace.mix t1 t2 = { hash := Lake.Hash.mix t1.hash t2.hash, mtime := max t1.mtime t2.mtime }
Instances For
Equations
- Lake.BuildTrace.instMixTraceBuildTrace = { mixTrace := Lake.BuildTrace.mix }
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
- Lake.BuildTrace.checkAgainstHash info hash self = (pure (hash == self.hash) <&&> Lake.checkExists info)
Instances For
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
- Lake.BuildTrace.checkAgainstTime info self = EIO.catchExceptions (do let __do_lift ← Lake.getMTime info pure (decide (self.mtime < __do_lift))) fun x => pure false
Instances For
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.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Lake.BuildTrace.writeToFile traceFile self = IO.FS.writeFile traceFile (Lake.Hash.toString self.hash)