@@ -7,6 +7,7 @@ module Language.Reflection.Elab
8import Builtins
8import Builtins
9import Prelude.Applicative
9import Prelude.Applicative
10import Prelude.Functor
11import Prelude.Functor
11import Prelude.List
12import Prelude.List
12import Prelude.Maybe
13import Prelude.Maybe
@@ -99,7 +100,8 @@ data Elab : Type -> Type where
100 prim__Solve : Elab ()
101 prim__Solve : Elab ()
101 prim__Fill : Raw -> Elab ()
102 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))
103 prim__Focus : TTName -> Elab ()
105 prim__Focus : TTName -> Elab ()
104 prim__Unfocus : TTName -> Elab ()
106 prim__Unfocus : TTName -> Elab ()
105 prim__Attack : Elab ()
107 prim__Attack : Elab ()
@@ -217,9 +219,49 @@ namespace Tactics
217 fill : Raw -> Elab ()
219 fill : Raw -> Elab ()
218 fill tm = prim__Fill tm
220 fill tm = prim__Fill tm
220− ||| Fill with unification
222+ ||| Attempt to apply an operator to fill the current hole,
223+ ||| potentially solving arugments by unification.
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.
230+ ||| Note that not all of the returned hole names still exist, as
231+ ||| they may have been solved.
233+ ||| @ op the term to apply
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
221− apply : Raw -> Elab ()
239+ apply : (op : Raw) ->
240+ (argSpec : List (Bool, Int)) ->
241+ Elab (List (TTName, TTName))
222− apply tm = prim__Apply tm
242+ apply tm argSpec = prim__Apply tm argSpec
244+ ||| Attempt to apply an operator to fill the current hole,
245+ ||| potentially solving arugments by matching.
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.
252+ ||| Note that not all of the returned hole names still exist, as
253+ ||| they may have been solved.
255+ ||| @ op the term to apply
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
261+ matchApply : (op : Raw) ->
262+ (argSpec : List (Bool, Int)) ->
263+ Elab (List (TTName, TTName))
264+ matchApply tm argSpec = prim__Apply tm argSpec
224 ||| Move the focus to the specified hole
266 ||| Move the focus to the specified hole