Documentation

Batteries.CodeAction.Match

Filter for the info-nodes to find the match-nodes.

Equations
    Instances For

      Returns the String.range that encompasses match e (with).

      Equations
        Instances For

          Flattens an Infotree into an array of Info-nodes that fulfill p.

          Equations
            Instances For

              From a constructor-name e.g. 'Option.some' construct the corresponding match pattern, e.g. '.some val'. We implement special cases for Nat and List, Option and Bool to e.g. produce 'n + 1' instead of 'Nat.succ n'.

              Equations
                Instances For

                  Invoking tactic code action "Generate a list of alternatives for this match." in the following:

                  def myfun2 (n : Nat) : Nat :=
                    match n
                  

                  produces:

                  def myfun2 (n : Nat) : Nat :=
                    match n with
                    | 0 => _
                    | n + 1 => _
                  

                  Also has support for multiple discriminants, e.g.

                  def myfun3 (o : Option Bool) (m : Nat) : Nat :=
                    match o, m with
                  

                  can be expanded into

                  def myfun3 (o : Option Bool) (m : Nat) : Nat :=
                    match o, m with
                    | none, 0 => _
                    | none, n_2 + 1 => _
                    | some val_1, 0 => _
                    | some val_1, n_2 + 1 => _
                  
                  Equations
                    Instances For