Documentation

Hale.CaseInsensitive.Data.CaseInsensitive

class Data.FoldCase (α : Type) :

Case-folding typeclass. Provides a function to fold a value to a canonical case. $$\text{foldCase} : \alpha \to \alpha$$

  • foldCase : αα
Instances
    structure Data.CI (α : Type) [FoldCase α] :

    A case-insensitive wrapper. Stores the original value and a pre-computed case-folded version. Equality and hashing compare only the folded form.

    $$\text{CI}(\alpha) = \{ \text{original} : \alpha,\; \text{foldedCase} : \alpha \}$$

    Invariant: foldedCase = FoldCase.foldCase original

    Instances For
      @[inline]
      def Data.CI.mk' {α : Type} [FoldCase α] (x : α) :
      CI α

      Smart constructor that computes the folded form automatically. $$\text{mk'}(x) = \text{CI}(x, \text{foldCase}(x))$$

      Equations
      Instances For
        @[inline]
        def Data.CI.map {α β : Type} [FoldCase α] [FoldCase β] (f : αβ) (ci : CI α) :
        CI β

        Map a function over both original and folded values. $$\text{map}(f, \text{CI}(o, fc)) = \text{CI}(f(o), \text{foldCase}(f(o)))$$

        Equations
        Instances For
          @[implicit_reducible]
          instance Data.CI.instBEq {α : Type} [FoldCase α] [BEq α] :
          BEq (CI α)
          Equations
          @[implicit_reducible]
          instance Data.CI.instHashable {α : Type} [FoldCase α] [Hashable α] :
          Equations
          @[implicit_reducible]
          instance Data.CI.instOrd {α : Type} [FoldCase α] [Ord α] :
          Ord (CI α)
          Equations
          @[implicit_reducible]
          instance Data.CI.instToString {α : Type} [FoldCase α] [ToString α] :
          Equations
          @[implicit_reducible]
          instance Data.CI.instRepr {α : Type} [FoldCase α] [Repr α] :
          Repr (CI α)
          Equations
          @[implicit_reducible]
          Equations
          @[implicit_reducible]
          Equations
          theorem Data.CI.ci_eq_iff {α : Type} [FoldCase α] [BEq α] (a b : CI α) :

          Two CI values are equal iff their folded cases are equal.