Match Notation #
Returns whether the value matches the pattern.
Equations
- Lake.«term_=~_» = Lean.ParserDescr.trailingNode `Lake.«term_=~_» 50 51 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " =~ ") (Lean.ParserDescr.cat `term 51))
Instances For
Abstract Patterns #
A pattern. Matches some subset of the values of a type. May also include a declarative description.
- filter : α → Bool
Returns whether the value matches the pattern.
- name : Lean.Name
An optional name for the filter.
- descr? : Option (PatternDescr α β)
A optional declarative description of the filter.
Instances For
Equations
- Lake.instInhabitedPatternDescr = { default := Lake.PatternDescr.not default }
An abstract declarative pattern.
Augments another pattern description β
with logical connectives.
- not
{α : Type u}
{β : Type v}
(p : Pattern α β)
: PatternDescr α β
Matches a value that does not satisfy the pattern.
- all
{α : Type u}
{β : Type v}
(ps : Array (Pattern α β))
: PatternDescr α β
Matches a value that satisfies every pattern. Short-circuits.
- any
{α : Type u}
{β : Type v}
(ps : Array (Pattern α β))
: PatternDescr α β
Matches a value that satisfies any one of the patterns. Short-circuits.
- coe
{α : Type u}
{β : Type v}
(p : β)
: PatternDescr α β
Matches a value that statisfies the underlying pattern description.
Instances For
Equations
- Lake.instCoePatternDescr = { coe := Lake.PatternDescr.coe }
Returns whether the value matches the pattern. Alias for filter
.
Equations
- Lake.Pattern.matches a self = self.filter a
Instances For
Equations
- Lake.instIsPatternPattern = { satisfies := Lake.Pattern.filter }
Returns whether the value matches the pattern.
Equations
- Lake.PatternDescr.matches val (Lake.PatternDescr.not p) = !Lake.IsPattern.satisfies p val
- Lake.PatternDescr.matches val (Lake.PatternDescr.all ps) = ps.all fun (x : Lake.Pattern α β) => Lake.IsPattern.satisfies x val
- Lake.PatternDescr.matches val (Lake.PatternDescr.any ps) = ps.any fun (x : Lake.Pattern α β) => Lake.IsPattern.satisfies x val
- Lake.PatternDescr.matches val (Lake.PatternDescr.coe p) = Lake.IsPattern.satisfies p val
Instances For
Equations
- Lake.instIsPatternPatternDescr = { satisfies := flip Lake.PatternDescr.matches }
Matches a value that satisfies an arbitrary predicate
(optionally identified by a Name
).
Equations
- Lake.Pattern.ofFn f name = { filter := f, name := name }
Instances For
Equations
- Lake.instCoeForallBoolPattern = { coe := fun (f : α → Bool) => Lake.Pattern.ofFn f }
Matches a string that satisfies the declarative pattern.
(optionally identified by a Name
).
Equations
- Lake.Pattern.ofDescr descr name = { filter := fun (x : α) => Lake.IsPattern.satisfies descr x, name := name, descr? := some descr }
Instances For
Equations
- Lake.instCoePatternDescrPatternOfIsPattern = { coe := fun (x : Lake.PatternDescr α β) => Lake.Pattern.ofDescr x }
Matches nothing.
Equations
Instances For
Matches nothing.
Equations
- Lake.Pattern.empty = { filter := fun (x : α) => false, name := `empty, descr? := some Lake.PatternDescr.empty }
Instances For
Equations
- Lake.instEmptyCollectionPatternDescr = { emptyCollection := Lake.PatternDescr.empty }
Equations
- Lake.instEmptyCollectionPattern = { emptyCollection := Lake.Pattern.empty }
Matches eveything.
Equations
Instances For
Matches eveything.
Equations
- Lake.Pattern.star = { filter := fun (x : α) => true, name := `star, descr? := some Lake.PatternDescr.star }
Instances For
String Patterns #
A declarative String
pattern. Matches some subset of strings.
- mem
(xs : Array String)
: StrPatDescr
Matches a string that is a member of the array
- startsWith
(affix : String)
: StrPatDescr
Matches a string that starts with this prefix.
- endsWith
(affix : String)
: StrPatDescr
Matches a string that ends with this suffix.
Instances For
Equations
- Lake.instInhabitedStrPatDescr = { default := Lake.StrPatDescr.mem default }
Returns whether the string matches the pattern.
Equations
Instances For
Equations
- Lake.instIsPatternStrPatDescrString = { satisfies := flip Lake.StrPatDescr.matches }
Matches nothing.
Equations
Instances For
Matches a value that satisfies an arbitrary predicate
(optionally identified by a Name
).
Equations
- Lake.StrPat.satisfies f name = Lake.Pattern.ofFn f name
Instances For
Matches a string that is a member of the array
Equations
Instances For
Equations
Equations
- Lake.instCoeArrayStringStrPat = { coe := Lake.StrPat.mem }
Matches a string that starts with this prefix.
Equations
Instances For
Matches a string that ends with this suffix.
Equations
Instances For
Matches a string that is equal to this one.
Equations
Instances For
Matches a string that is a member of the array
Equations
- Lake.StrPat.beq s = { filter := fun (x : String) => x == s, descr? := some (Lake.PatternDescr.coe (Lake.StrPatDescr.beq s)) }
Instances For
Equations
- Lake.instCoeStringStrPatDescr = { coe := Lake.StrPatDescr.beq }
Equations
- Lake.instCoeStringStrPat = { coe := Lake.StrPat.beq }
File Path Patterns #
A declarative FilePath
pattern. Matches some subset of file paths.
- path
(p : StrPat)
: PathPatDescr
Matches a file path whose normalized string representation satisfies the pattern.
- extension
(p : StrPat)
: PathPatDescr
Matches a file path whose extension satisfies the pattern.
- fileName
(p : StrPat)
: PathPatDescr
Matches a file path whose name satisfies the pattern.
Instances For
Equations
- Lake.instInhabitedPathPatDescr = { default := Lake.PathPatDescr.path default }
Matches a file path that is equal to this one (when both are normalized).
Equations
Instances For
Returns whether the string matches the pattern.
Equations
- Lake.PathPatDescr.matches path (Lake.PathPatDescr.path p) = Lake.IsPattern.satisfies p path.normalize.toString
- Lake.PathPatDescr.matches path (Lake.PathPatDescr.extension p) = Option.any (fun (x : String) => Lake.IsPattern.satisfies p x) path.extension
- Lake.PathPatDescr.matches path (Lake.PathPatDescr.fileName p) = Option.any (fun (x : String) => Lake.IsPattern.satisfies p x) path.fileName
Instances For
Equations
- Lake.instIsPatternPathPatDescrFilePath = { satisfies := flip Lake.PathPatDescr.matches }
A FilePath
pattern. Matches some subset of file paths.
Instances For
Matches a file path whose normalized string representation satisfies the pattern.
Equations
Instances For
Matches a file path whose extension satisfies the pattern.
Equations
Instances For
Matches a file path whose name satisfies the pattern.
Equations
Instances For
Version-specific Patterns #
Whether a string is "version-like".
That is, a v
followed by a digit.
Equations
- Lake.isVerLike s = if h : s.utf8ByteSize ≥ 2 then s.get' 0 ⋯ == 'v' && (s.get' { byteIdx := 1 } ⋯).isDigit else false
Instances For
Matches a "version-like" string: a v
followed by a digit.
Equations
Instances For
Default string pattern for a Package's versionTags
.
Equations
Instances For
Builtin StrPat
presets available to TOML for versionTags
.
Equations
- Lake.versionTagPresets = (Lake.NameMap.empty.insert `verLike Lake.StrPat.verLike).insert `default Lake.defaultVersionTags