You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source/interactive.rst
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -80,7 +80,7 @@ Narya has a limited ability to infer the shape of a term to solve a hole with fr
80
80
81
81
If none of these cases apply, an error results.
82
82
83
-
Note that the term generated by a split is not guaranteed to typecheck. For example, if the goal is an indexed datatype with one constructor, splitting will generate an application of that constructor to holes; but if the indices depend at all on the arguments of the constructor, this will not typecheck since Narya will be unable to tell whether the indices agree with those of the goal. More mundanely, if a datatype constructor is declared with multiple arguments of the same name such as ``data [ constr. (x:A) (x:A) ]`` (I don't know why you would do that, but it's allowed with the second ``x`` shadowing the first), splitting on a term of that type will generate a match such as ``match u [ constr. x x ↦ ? ]``, which fails to typecheck because the pattern variables in each branch of a match are required to be distinct.
83
+
Note that the term generated by a split is not guaranteed to typecheck. For example, if the goal is an indexed datatype with one constructor, splitting will generate an application of that constructor to holes; but if the indices depend at all on the arguments of the constructor, this will not typecheck since Narya will be unable to tell whether the indices agree with those of the goal.
84
84
85
85
You can also split on a hole directly in interactive mode, identifying a hole by its number as in ``split 0 ≔ M`` to split on a term ``M``, or ``split 0 ≔ _`` to split on the goal type. This will print the proposed term with the label "hole could be solved by"; you can then copy it, edit it as desired, and supply it to a ``solve`` command.
(* We have a list of terms and we need to produce a multiple match. We use a list monad to produce all possible combinations of constructors for all the types of all the terms, with a boolean state outside the list to track, whether it contains any higher-dimensional matches and thus should use a ⤇ instead of a ↦. And we use a Names state *inside* the list to uniquify variables separately in each branch. *)
0 commit comments