@@ -104,62 +104,62 @@ record Datatype where
104104abstract
105105data Elab : Type -> Type where
106106 -- obligatory control stuff
107− prim__PureElab : a -> Elab a
108− prim__BindElab : {a, b : Type} -> Elab a -> (a -> Elab b) -> Elab b
107+ Prim__PureElab : a -> Elab a
108+ Prim__BindElab : {a, b : Type} -> Elab a -> (a -> Elab b) -> Elab b
109109
110− prim__Try : {a : Type} -> Elab a -> Elab a -> Elab a
111− prim__Fail : {a : Type} -> List ErrorReportPart -> Elab a
110+ Prim__Try : {a : Type} -> Elab a -> Elab a -> Elab a
111+ Prim__Fail : {a : Type} -> List ErrorReportPart -> Elab a
112112
113− prim__Env : Elab (List (TTName, Binder TT))
114− prim__Goal : Elab (TTName, TT)
115− prim__Holes : Elab (List TTName)
116− prim__Guess : Elab (Maybe TT)
117− prim__LookupTy : TTName -> Elab (List (TTName, NameType, TT))
118− prim__LookupDatatype : TTName -> Elab (List Datatype)
119− prim__LookupArgs : TTName -> Elab (List (TTName, List FunArg, Raw))
113+ Prim__Env : Elab (List (TTName, Binder TT))
114+ Prim__Goal : Elab (TTName, TT)
115+ Prim__Holes : Elab (List TTName)
116+ Prim__Guess : Elab (Maybe TT)
117+ Prim__LookupTy : TTName -> Elab (List (TTName, NameType, TT))
118+ Prim__LookupDatatype : TTName -> Elab (List Datatype)
119+ Prim__LookupArgs : TTName -> Elab (List (TTName, List FunArg, Raw))
120120
121− prim__Check : List (TTName, Binder TT) -> Raw -> Elab (TT, TT)
121+ Prim__Check : List (TTName, Binder TT) -> Raw -> Elab (TT, TT)
122122
123− prim__SourceLocation : Elab SourceLocation
124− prim__Namespace : Elab (List String)
123+ Prim__SourceLocation : Elab SourceLocation
124+ Prim__Namespace : Elab (List String)
125125
126− prim__Gensym : String -> Elab TTName
126+ Prim__Gensym : String -> Elab TTName
127127
128− prim__Solve : Elab ()
129− prim__Fill : Raw -> Elab ()
130− prim__Apply : Raw -> List Bool -> Elab (List (TTName, TTName))
131− prim__MatchApply : Raw -> List Bool -> Elab (List (TTName, TTName))
132− prim__Focus : TTName -> Elab ()
133− prim__Unfocus : TTName -> Elab ()
134− prim__Attack : Elab ()
128+ Prim__Solve : Elab ()
129+ Prim__Fill : Raw -> Elab ()
130+ Prim__Apply : Raw -> List Bool -> Elab (List (TTName, TTName))
131+ Prim__MatchApply : Raw -> List Bool -> Elab (List (TTName, TTName))
132+ Prim__Focus : TTName -> Elab ()
133+ Prim__Unfocus : TTName -> Elab ()
134+ Prim__Attack : Elab ()
135135
136− prim__Rewrite : Raw -> Elab ()
136+ Prim__Rewrite : Raw -> Elab ()
137137
138− prim__Claim : TTName -> Raw -> Elab ()
139− prim__Intro : Maybe TTName -> Elab ()
140− prim__Forall : TTName -> Raw -> Elab ()
141− prim__PatVar : TTName -> Elab ()
142− prim__PatBind : TTName -> Elab ()
143− prim__LetBind : TTName -> Raw -> Raw -> Elab ()
138+ Prim__Claim : TTName -> Raw -> Elab ()
139+ Prim__Intro : Maybe TTName -> Elab ()
140+ Prim__Forall : TTName -> Raw -> Elab ()
141+ Prim__PatVar : TTName -> Elab ()
142+ Prim__PatBind : TTName -> Elab ()
143+ Prim__LetBind : TTName -> Raw -> Raw -> Elab ()
144144
145− prim__Compute : Elab ()
146− prim__Normalise : (List (TTName, Binder TT)) -> TT -> Elab TT
147− prim__Whnf : TT -> Elab TT
148− prim__Converts : (List (TTName, Binder TT)) -> TT -> TT -> Elab ()
145+ Prim__Compute : Elab ()
146+ Prim__Normalise : (List (TTName, Binder TT)) -> TT -> Elab TT
147+ Prim__Whnf : TT -> Elab TT
148+ Prim__Converts : (List (TTName, Binder TT)) -> TT -> TT -> Elab ()
149149
150− prim__DeclareType : TyDecl -> Elab ()
151− prim__DefineFunction : FunDefn -> Elab ()
152− prim__AddInstance : TTName -> TTName -> Elab ()
153− prim__IsTCName : TTName -> Elab Bool
150+ Prim__DeclareType : TyDecl -> Elab ()
151+ Prim__DefineFunction : FunDefn -> Elab ()
152+ Prim__AddInstance : TTName -> TTName -> Elab ()
153+ Prim__IsTCName : TTName -> Elab Bool
154154
155− prim__ResolveTC : TTName -> Elab ()
156− prim__Search : Int -> List TTName -> Elab ()
157− prim__RecursiveElab : Raw -> Elab () -> Elab (TT, TT)
155+ Prim__ResolveTC : TTName -> Elab ()
156+ Prim__Search : Int -> List TTName -> Elab ()
157+ Prim__RecursiveElab : Raw -> Elab () -> Elab (TT, TT)
158158
159− prim__Fixity : String -> Elab Fixity
159+ Prim__Fixity : String -> Elab Fixity
160160
161− prim__Debug : {a : Type} -> List ErrorReportPart -> Elab a
162− prim__Metavar : TTName -> Elab ()
161+ Prim__Debug : {a : Type} -> List ErrorReportPart -> Elab a
162+ Prim__Metavar : TTName -> Elab ()
163163
164164-------------
165165-- Public API
@@ -167,47 +167,47 @@ data Elab : Type -> Type where
167167%access public
168168namespace Tactics
169169 instance Functor Elab where
170− map f t = prim__BindElab t (\x => prim__PureElab (f x))
170+ map f t = Prim__BindElab t (\x => Prim__PureElab (f x))
171171
172172 instance Applicative Elab where
173− pure x = prim__PureElab x
174− f <*> x = prim__BindElab f $ \g =>
175− prim__BindElab x $ \y =>
176− prim__PureElab $ g y
173+ pure x = Prim__PureElab x
174+ f <*> x = Prim__BindElab f $ \g =>
175+ Prim__BindElab x $ \y =>
176+ Prim__PureElab $ g y
177177
178178 ||| The Alternative instance on Elab represents left-biased error
179179 ||| handling. In other words, `t <|> t'` will run `t`, and if it
180180 ||| fails, roll back the elaboration state and run `t'`.
181181 instance Alternative Elab where
182− empty = prim__Fail [TextPart "empty"]
183− x <|> y = prim__Try x y
182+ empty = Prim__Fail [TextPart "empty"]
183+ x <|> y = Prim__Try x y
184184
185185 instance Monad Elab where
186− x >>= f = prim__BindElab x f
186+ x >>= f = Prim__BindElab x f
187187
188188 ||| Halt elaboration with an error
189189 fail : List ErrorReportPart -> Elab a
190− fail err = prim__Fail err
190+ fail err = Prim__Fail err
191191
192192 ||| Look up the lexical binding at the focused hole. Fails if no holes are present.
193193 getEnv : Elab (List (TTName, Binder TT))
194− getEnv = prim__Env
194+ getEnv = Prim__Env
195195
196196 ||| Get the name and type of the focused hole. Fails if not holes are present.
197197 getGoal : Elab (TTName, TT)
198− getGoal = prim__Goal
198+ getGoal = Prim__Goal
199199
200200 ||| Get the hole queue, in order.
201201 getHoles : Elab (List TTName)
202− getHoles = prim__Holes
202+ getHoles = Prim__Holes
203203
204204 ||| If the current hole contains a guess, return it. Otherwise, fail.
205205 getGuess : Elab (Maybe TT)
206− getGuess = prim__Guess
206+ getGuess = Prim__Guess
207207
208208 ||| Look up the types of every overloading of a name.
209209 lookupTy : TTName -> Elab (List (TTName, NameType, TT))
210− lookupTy n = prim__LookupTy n
210+ lookupTy n = Prim__LookupTy n
211211
212212 ||| Get the type of a fully-qualified name. Fail if it doesn not
213213 ||| resolve uniquely.
@@ -220,7 +220,7 @@ namespace Tactics
220220 ||| Find the reflected representation of all datatypes whose names
221221 ||| are overloadings of some name.
222222 lookupDatatype : TTName -> Elab (List Datatype)
223− lookupDatatype n = prim__LookupDatatype n
223+ lookupDatatype n = Prim__LookupDatatype n
224224
225225 ||| Find the reflected representation of a datatype, given its
226226 ||| fully-qualified name. Fail if the name does not uniquely resolve
@@ -234,7 +234,7 @@ namespace Tactics
234234
235235 ||| Get the argument specification for each overloading of a name.
236236 lookupArgs : TTName -> Elab (List (TTName, List FunArg, Raw))
237− lookupArgs n = prim__LookupArgs n
237+ lookupArgs n = Prim__LookupArgs n
238238
239239 ||| Get the argument specification for a name. Fail if the name does
240240 ||| not uniquely resolve.
@@ -249,7 +249,7 @@ namespace Tactics
249249 ||| @ env the environment within which to check the type
250250 ||| @ tm the term to check
251251 check : (env : List (TTName, Binder TT)) -> (tm : Raw) -> Elab (TT, TT)
252− check env tm = prim__Check env tm
252+ check env tm = Prim__Check env tm
253253
254254
255255 ||| Generate a unique name based on some hint.
@@ -257,16 +257,16 @@ namespace Tactics
257257 ||| **NB**: the generated name is unique _for this run of the
258258 ||| elaborator_. Do not assume that they are globally unique.
259259 gensym : (hint : String) -> Elab TTName
260− gensym hint = prim__Gensym hint
260+ gensym hint = Prim__Gensym hint
261261
262262 ||| Substitute a guess into a hole.
263263 solve : Elab ()
264− solve = prim__Solve
264+ solve = Prim__Solve
265265
266266 ||| Place a term into a hole, unifying its type. Fails if the focus
267267 ||| is not a hole.
268268 fill : Raw -> Elab ()
269− fill tm = prim__Fill tm
269+ fill tm = Prim__Fill tm
270270
271271 ||| Attempt to apply an operator to fill the current hole,
272272 ||| potentially solving arguments by unification.
@@ -283,7 +283,7 @@ namespace Tactics
283283 ||| where the Boolean states whether or not to attempt to solve
284284 ||| the argument by unification.
285285 apply : (op : Raw) -> (argSpec : List Bool) -> Elab (List TTName)
286− apply tm argSpec = map snd <$> prim__Apply tm argSpec
286+ apply tm argSpec = map snd <$> Prim__Apply tm argSpec
287287
288288 ||| Attempt to apply an operator to fill the current hole,
289289 ||| potentially solving arguments by matching.
@@ -301,19 +301,19 @@ namespace Tactics
301301 ||| the argument by matching.
302302
303303 matchApply : (op : Raw) -> (argSpec : List Bool) -> Elab (List TTName)
304− matchApply tm argSpec = map snd <$> prim__Apply tm argSpec
304+ matchApply tm argSpec = map snd <$> Prim__Apply tm argSpec
305305
306306 ||| Move the focus to the specified hole. Fails if the hole does not
307307 ||| exist.
308308 |||
309309 ||| @ hole the hole to focus on
310310 focus : (hole : TTName) -> Elab ()
311− focus hole = prim__Focus hole
311+ focus hole = Prim__Focus hole
312312
313313 ||| Send the currently-focused hole to the end of the hole queue and
314314 ||| focus on the next hole.
315315 unfocus : TTName -> Elab ()
316− unfocus hole = prim__Unfocus hole
316+ unfocus hole = Prim__Unfocus hole
317317
318318 ||| Convert a hole to make it suitable for bindings - that is,
319319 ||| transform it such that it has the form `?h : t . h` as opposed to
@@ -324,7 +324,7 @@ namespace Tactics
324324 ||| sense. This tactic creates a new hole of the proper form, and
325325 ||| points the old hole at it.
326326 attack : Elab ()
327− attack = prim__Attack
327+ attack = Prim__Attack
328328
329329 ||| Introduce a new hole with a specified name and type.
330330 |||
@@ -332,7 +332,7 @@ namespace Tactics
332332 ||| will be immediately after it in the hole queue. Because this
333333 ||| tactic introduces a new binding, you may need to `attack` first.
334334 claim : TTName -> Raw -> Elab ()
335− claim n ty = prim__Claim n ty
335+ claim n ty = Prim__Claim n ty
336336
337337 ||| Introduce a lambda binding around the current hole and focus on
338338 ||| the body. Requires that the hole be in binding form (use
@@ -340,7 +340,7 @@ namespace Tactics
340340 |||
341341 ||| @ n the name to use for the argument
342342 intro : (n : TTName) -> Elab ()
343− intro n = prim__Intro (Just n)
343+ intro n = Prim__Intro (Just n)
344344
345345 ||| Introduce a lambda binding around the current hole and focus on
346346 ||| the body, using the name provided by the type of the
@@ -349,7 +349,7 @@ namespace Tactics
349349 ||| Requires that the hole be immediately under its binder (use
350350 ||| `attack` if it might not be).
351351 intro' : Elab ()
352− intro' = prim__Intro Nothing
352+ intro' = Prim__Intro Nothing
353353
354354 ||| Introduce a dependent function type binding into the current hole,
355355 ||| and focus on the body.
@@ -357,18 +357,18 @@ namespace Tactics
357357 ||| Requires that the hole be immediately under its binder (use
358358 ||| `attack` if it might not be).
359359 forall : TTName -> Raw -> Elab ()
360− forall n ty = prim__Forall n ty
360+ forall n ty = Prim__Forall n ty
361361
362362 ||| Convert a hole into a pattern variable.
363363 patvar : TTName -> Elab ()
364− patvar n = prim__PatVar n
364+ patvar n = Prim__PatVar n
365365
366366 ||| Introduce a new pattern binding.
367367 |||
368368 ||| Requires that the hole be immediately under its binder (use
369369 ||| `attack` if it might not be).
370370 patbind : TTName -> Elab ()
371− patbind n = prim__PatBind n
371+ patbind n = Prim__PatBind n
372372
373373 ||| Introduce a new let binding.
374374 |||
@@ -379,24 +379,24 @@ namespace Tactics
379379 ||| @ ty the type of the term to be let-bound
380380 ||| @ tm the term to be bound
381381 letbind : (n : TTName) -> (ty, tm : Raw) -> Elab ()
382− letbind n ty tm = prim__LetBind n ty tm
382+ letbind n ty tm = Prim__LetBind n ty tm
383383
384384 ||| Normalise the goal.
385385 compute : Elab ()
386− compute = prim__Compute
386+ compute = Prim__Compute
387387
388388 ||| Normalise a term in some lexical environment
389389 |||
390390 ||| @ env the environment in which to compute (get one of these from `getEnv`)
391391 ||| @ term the term to normalise
392392 normalise : (env : List (TTName, Binder TT)) -> (term : TT) -> Elab TT
393− normalise env term = prim__Normalise env term
393+ normalise env term = Prim__Normalise env term
394394
395395 ||| Reduce a closed term to weak-head normal form
396396 |||
397397 ||| @ term the term to reduce
398398 whnf : (term : TT) -> Elab TT
399− whnf term = prim__Whnf term
399+ whnf term = Prim__Whnf term
400400
401401 ||| Check that two terms are convertable in the current context and
402402 ||| in some environment.
@@ -405,7 +405,7 @@ namespace Tactics
405405 ||| @ term1 the first term to convert
406406 ||| @ term2 the second term to convert
407407 convertsInEnv : (env : List (TTName, Binder TT)) -> (term1, term2 : TT) -> Elab ()
408− convertsInEnv env term1 term2 = prim__Converts env term1 term2
408+ convertsInEnv env term1 term2 = Prim__Converts env term1 term2
409409
410410 ||| Check that two terms are convertable in the current context and environment
411411 |||
@@ -416,7 +416,7 @@ namespace Tactics
416416
417417 ||| Find the source context for the elaboration script
418418 getSourceLocation : Elab SourceLocation
419− getSourceLocation = prim__SourceLocation
419+ getSourceLocation = Prim__SourceLocation
420420
421421 ||| Attempt to solve the current goal with the source code location
422422 sourceLocation : Elab ()
@@ -430,7 +430,7 @@ namespace Tactics
430430 ||| The namespace is represented as a reverse-order list of strings,
431431 ||| just as in the representation of names.
432432 currentNamespace : Elab (List String)
433− currentNamespace = prim__Namespace
433+ currentNamespace = Prim__Namespace
434434
435435 ||| Attempt to rewrite the goal using an equality.
436436 |||
@@ -443,48 +443,48 @@ namespace Tactics
443443 ||| requires that the hole be immediately under its binder (use
444444 ||| `attack` if it might not be).
445445 rewriteWith : Raw -> Elab ()
446− rewriteWith rule = prim__Rewrite rule
446+ rewriteWith rule = Prim__Rewrite rule
447447
448448 ||| Add a type declaration to the global context.
449449 declareType : TyDecl -> Elab ()
450− declareType decl = prim__DeclareType decl
450+ declareType decl = Prim__DeclareType decl
451451
452452 ||| Define a function in the global context. The function must have
453453 ||| already been declared, either in ordinary Idris code or using
454454 ||| `declareType`.
455455 defineFunction : FunDefn -> Elab ()
456− defineFunction defun = prim__DefineFunction defun
456+ defineFunction defun = Prim__DefineFunction defun
457457
458458 ||| Register a new instance for type class resolution.
459459 |||
460460 ||| @ className the name of the class for which an instance is being registered
461461 ||| @ instName the name of the definition to use in instance search
462462 addInstance : (className, instName : TTName) -> Elab ()
463− addInstance className instName = prim__AddInstance className instName
463+ addInstance className instName = Prim__AddInstance className instName
464464
465465 ||| Determine whether a name denotes a class.
466466 |||
467467 ||| @ name a name that might denote a class.
468468 isTCName : (name : TTName) -> Elab Bool
469− isTCName name = prim__IsTCName name
469+ isTCName name = Prim__IsTCName name
470470
471471 ||| Attempt to solve the current goal with a type class dictionary
472472 |||
473473 ||| @ fn the name of the definition being elaborated (to prevent Idris
474474 ||| from looping)
475475 resolveTC : (fn : TTName) -> Elab ()
476− resolveTC fn = prim__ResolveTC fn
476+ resolveTC fn = Prim__ResolveTC fn
477477
478478 ||| Use Idris's internal proof search.
479479 search : Elab ()
480− search = prim__Search 100 []
480+ search = Prim__Search 100 []
481481
482482 ||| Use Idris's internal proof search, with more control.
483483 |||
484484 ||| @ depth the search depth
485485 ||| @ hints additional names to try
486486 search' : (depth : Int) -> (hints : List TTName) -> Elab ()
487− search' depth hints = prim__Search depth hints
487+ search' depth hints = Prim__Search depth hints
488488
489489 ||| Look up the declared fixity for an operator.
490490 |||
@@ -493,14 +493,14 @@ namespace Tactics
493493 |||
494494 ||| @ operator the operator string to look up
495495 operatorFixity : (operator : String) -> Elab Fixity
496− operatorFixity operator = prim__Fixity operator
496+ operatorFixity operator = Prim__Fixity operator
497497
498498 ||| Halt elaboration, dumping the internal state for inspection.
499499 |||
500500 ||| This is intended for elaboration script developers, not for
501501 ||| end-users. Use `fail` for final scripts.
502502 debug : Elab a
503− debug = prim__Debug []
503+ debug = Prim__Debug []
504504
505505 ||| Halt elaboration, dumping the internal state and displaying a
506506 ||| message.
@@ -510,17 +510,17 @@ namespace Tactics
510510 |||
511511 ||| @ msg the message to display
512512 debugMessage : (msg : List ErrorReportPart) -> Elab a
513− debugMessage msg = prim__Debug msg
513+ debugMessage msg = Prim__Debug msg
514514
515515 ||| Create a new top-level metavariable to solve the current hole.
516516 |||
517517 ||| @ name the name for the top-level variable
518518 metavar : (name : TTName) -> Elab ()
519− metavar name = prim__Metavar name
519+ metavar name = Prim__Metavar name
520520
521521 ||| Recursively invoke the reflected elaborator with some goal.
522522 |||
523523 ||| The result is the final term and its type.
524524 runElab : Raw -> Elab () -> Elab (TT, TT)
525− runElab goal script = prim__RecursiveElab goal script
525+ runElab goal script = Prim__RecursiveElab goal script
526526