@@ -7,6 +7,7 @@ module Language.Reflection.Elab
77
88import Builtins
99import Prelude.Applicative
10+import Prelude.Bool
1011import Prelude.Functor
1112import Prelude.List
1213import Prelude.Maybe
@@ -99,7 +100,8 @@ data Elab : Type -> Type where
99100
100101 prim__Solve : Elab ()
101102 prim__Fill : Raw -> Elab ()
102− prim__Apply : Raw -> Elab ()
103+ prim__Apply : Raw -> List (Bool, Int) -> Elab (List (TTName, TTName))
104+ prim__MatchApply : Raw -> List (Bool, Int) -> Elab (List (TTName, TTName))
103105 prim__Focus : TTName -> Elab ()
104106 prim__Unfocus : TTName -> Elab ()
105107 prim__Attack : Elab ()
@@ -217,9 +219,49 @@ namespace Tactics
217219 fill : Raw -> Elab ()
218220 fill tm = prim__Fill tm
219221
220− ||| Fill with unification
221− apply : Raw -> Elab ()
222− apply tm = prim__Apply tm
222+ ||| Attempt to apply an operator to fill the current hole,
223+ ||| potentially solving arugments by unification.
224+ |||
225+ ||| The return value is a list of pairs of names, one for each input
226+ ||| argument. The first projection of these pairs is the original
227+ ||| name of the argument, from the type declaration, and the second
228+ ||| projection is the hole into which it is placed.
229+ |||
230+ ||| Note that not all of the returned hole names still exist, as
231+ ||| they may have been solved.
232+ |||
233+ ||| @ op the term to apply
234+ |||
235+ ||| @ argSpec instructions for finding the arguments to the term,
236+ ||| where the Boolean states whether or not to attempt to solve
237+ ||| the argument and the Int gives the priority in which to do
238+ ||| so
239+ apply : (op : Raw) ->
240+ (argSpec : List (Bool, Int)) ->
241+ Elab (List (TTName, TTName))
242+ apply tm argSpec = prim__Apply tm argSpec
243+
244+ ||| Attempt to apply an operator to fill the current hole,
245+ ||| potentially solving arugments by matching.
246+ |||
247+ ||| The return value is a list of pairs of names, one for each input
248+ ||| argument. The first projection of these pairs is the original
249+ ||| name of the argument, from the type declaration, and the second
250+ ||| projection is the hole into which it is placed.
251+ |||
252+ ||| Note that not all of the returned hole names still exist, as
253+ ||| they may have been solved.
254+ |||
255+ ||| @ op the term to apply
256+ |||
257+ ||| @ argSpec instructions for finding the arguments to the term,
258+ ||| where the Boolean states whether or not to attempt to solve
259+ ||| the argument and the Int gives the priority in which to do
260+ ||| so
261+ matchApply : (op : Raw) ->
262+ (argSpec : List (Bool, Int)) ->
263+ Elab (List (TTName, TTName))
264+ matchApply tm argSpec = prim__Apply tm argSpec
223265
224266 ||| Move the focus to the specified hole
225267 |||