Documentation

Lake.Config.Pattern

Match Notation #

class Lake.IsPattern (α : Type u) (β : outParam (Type v)) :
Type (max u v)
  • satisfies (pat : α) (val : β) : Bool

    Returns whether the value matches the pattern.

Instances

Returns whether the value matches the pattern.

Equations

Abstract Patterns #

structure Lake.Pattern (α : Type u) (β : Type v) :
Type (max u v)

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
instance Lake.instInhabitedPattern {a✝ : Type u_1} {a✝¹ : Type u_2} :
Inhabited (Pattern a✝ a✝¹)
Equations
inductive Lake.PatternDescr (α : Type u) (β : Type v) :
Type (max u v)

An abstract declarative pattern. Augments another pattern description β with logical connectives.

Instances For
@[reducible, inline]
abbrev Lake.Pattern.matches {α : Type u_1} {β : Type u_2} (a : α) (self : Pattern α β) :

Returns whether the value matches the pattern. Alias for filter.

Equations
instance Lake.instIsPatternPattern {α : Type u_1} {β : Type u_2} :
IsPattern (Pattern α β) α
Equations
@[specialize #[]]
def Lake.PatternDescr.matches {β : Type u_1} {α : Type u_2} [IsPattern β α] (val : α) (self : PatternDescr α β) :

Returns whether the value matches the pattern.

Equations
@[inline]
def Lake.Pattern.ofFn {α : Type u_1} {β : Type u_2} (f : αBool) (name : Lean.Name := Lean.Name.anonymous) :
Pattern α β

Matches a value that satisfies an arbitrary predicate (optionally identified by a Name).

Equations
instance Lake.instCoeForallBoolPattern {α : Type u_1} {β : Type u_2} :
Coe (αBool) (Pattern α β)
Equations
@[inline]
def Lake.Pattern.ofDescr {β : Type (max u_1 u_2)} {α : Type u_2} [IsPattern β α] (descr : PatternDescr α β) (name : Lean.Name := Lean.Name.anonymous) :
Pattern α β

Matches a string that satisfies the declarative pattern. (optionally identified by a Name).

Equations
instance Lake.instCoePatternDescrPatternOfIsPattern {β : Type (max u_1 u_2)} {α : Type u_1} [IsPattern β α] :
Coe (PatternDescr α β) (Pattern α β)
Equations
@[inline]
def Lake.Pattern.not {β : Type (max u_1 u_2)} {α : Type u_1} [IsPattern β α] (p : Pattern α β) :
Pattern α β

Matches a value that satisfies every pattern. Short-circuits.

Equations
@[inline]
def Lake.Pattern.all {β : Type (max u_1 u_2)} {α : Type u_1} [IsPattern β α] (ps : Array (Pattern α β)) :
Pattern α β

Matches a value that satisfies every pattern. Short-circuits.

Equations
@[inline]
def Lake.Pattern.any {β : Type (max u_1 u_2)} {α : Type u_1} [IsPattern β α] (ps : Array (Pattern α β)) :
Pattern α β

Matches a value that satisfies every pattern. Short-circuits.

Equations
def Lake.Pattern.empty {α : Type u_1} {β : Type u_2} :
Pattern α β

Matches nothing.

Equations
def Lake.PatternDescr.star {α : Type u_1} {β : Type u_2} :

Matches everything.

Equations
def Lake.Pattern.star {α : Type u_1} {β : Type u_2} :
Pattern α β

Matches everything.

Equations

String Patterns #

A declarative String pattern. Matches some subset of strings.

Instances For
@[reducible, inline, deprecated Lake.Pattern.empty (since := "2025-03-27")]

Matches nothing.

Equations
@[reducible, inline, deprecated Lake.Pattern.ofFn (since := "2025-03-27")]

Matches a value that satisfies an arbitrary predicate (optionally identified by a Name).

Equations
@[inline]

Matches a string that is a member of the array

Equations
@[inline]

Matches a string that starts with this prefix.

Equations
@[inline]

Matches a string that ends with this suffix.

Equations

Matches a string that is equal to this one.

Equations
@[inline]

Matches a string that is a member of the array

Equations

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
@[inline]

Matches a file path that is equal to this one (when both are normalized).

Equations
@[reducible, inline]

A FilePath pattern. Matches some subset of file paths.

Equations
Instances For
@[inline]

Matches a file path whose normalized string representation satisfies the pattern.

Equations
@[inline]

Matches a file path whose extension satisfies the pattern.

Equations
@[inline]

Matches a file path whose name satisfies the pattern.

Equations

Version-specific Patterns #

Whether a string is "version-like". That is, a v followed by a digit.

Equations

Matches a "version-like" string: a v followed by a digit.

Equations

Default string pattern for a Package's versionTags.

Equations