@@ -173,30 +173,30 @@ elaborating_app = do ES (ps, _) _ _ <- get
174-- Some handy gadgets for pulling out bits of state
174-- Some handy gadgets for pulling out bits of state
176−-- get the global context
176+-- | Get the global context
177get_context :: Elab' aux Context
177get_context :: Elab' aux Context
178get_context = do ES p _ _ <- get
178get_context = do ES p _ _ <- get
179 return $! (context (fst p))
179 return $! (context (fst p))
181−-- update the context
181+-- | Update the context.
182-- (should only be used for adding temporary definitions or all sorts of
182-- (should only be used for adding temporary definitions or all sorts of
183-- stuff could go wrong)
183-- stuff could go wrong)
184set_context :: Context -> Elab' aux ()
184set_context :: Context -> Elab' aux ()
185set_context ctxt = do ES (p, a) logs prev <- get
185set_context ctxt = do ES (p, a) logs prev <- get
186 put (ES (p { context = ctxt }, a) logs prev)
186 put (ES (p { context = ctxt }, a) logs prev)
188−-- get the proof term
188+-- | get the proof term
189get_term :: Elab' aux Term
189get_term :: Elab' aux Term
190get_term = do ES p _ _ <- get
190get_term = do ES p _ _ <- get
191 return $! (getProofTerm (pterm (fst p)))
191 return $! (getProofTerm (pterm (fst p)))
193−-- get the proof term
193+-- | get the proof term
194update_term :: (Term -> Term) -> Elab' aux ()
194update_term :: (Term -> Term) -> Elab' aux ()
195update_term f = do ES (p,a) logs prev <- get
195update_term f = do ES (p,a) logs prev <- get
196 let p' = p { pterm = mkProofTerm (f (getProofTerm (pterm p))) }
196 let p' = p { pterm = mkProofTerm (f (getProofTerm (pterm p))) }
197 put (ES (p', a) logs prev)
197 put (ES (p', a) logs prev)
199−-- get the local context at the currently in focus hole
199+-- | get the local context at the currently in focus hole
200get_env :: Elab' aux Env
200get_env :: Elab' aux Env
201get_env = do ES p _ _ <- get
201get_env = do ES p _ _ <- get
202 lift $ envAtFocus (fst p)
202 lift $ envAtFocus (fst p)
@@ -213,14 +213,14 @@ get_probs :: Elab' aux Fails
213get_probs = do ES p _ _ <- get
213get_probs = do ES p _ _ <- get
214 return $! (problems (fst p))
214 return $! (problems (fst p))
216−-- Return recently solved names (that is, the names solved since the
216+-- | Return recently solved names (that is, the names solved since the
217-- last call to get_recents)
217-- last call to get_recents)
218get_recents :: Elab' aux [Name]
218get_recents :: Elab' aux [Name]
219get_recents = do ES (p, a) l prev <- get
219get_recents = do ES (p, a) l prev <- get
220 put (ES (p { recents = [] }, a) l prev)
220 put (ES (p { recents = [] }, a) l prev)
221 return (recents p)
221 return (recents p)
223−-- get the current goal type
223+-- | get the current goal type
224goal :: Elab' aux Type
224goal :: Elab' aux Type
225goal = do ES p _ _ <- get
225goal = do ES p _ _ <- get
226 b <- lift $ goalAtFocus (fst p)
226 b <- lift $ goalAtFocus (fst p)
@@ -233,7 +233,7 @@ is_guess = do ES p _ _ <- get
233 Guess _ _ -> return True
233 Guess _ _ -> return True
234 _ -> return False
234 _ -> return False
236−-- Get the guess at the current hole, if there is one
236+-- | Get the guess at the current hole, if there is one
237get_guess :: Elab' aux Type
237get_guess :: Elab' aux Type
238get_guess = do ES p _ _ <- get
238get_guess = do ES p _ _ <- get
239 b <- lift $ goalAtFocus (fst p)
239 b <- lift $ goalAtFocus (fst p)
@@ -241,7 +241,7 @@ get_guess = do ES p _ _ <- get
241 Guess t v -> return $! v
241 Guess t v -> return $! v
242 _ -> fail "Not a guess"
242 _ -> fail "Not a guess"
244−-- typecheck locally
244+-- | Typecheck locally
245get_type :: Raw -> Elab' aux Type
245get_type :: Raw -> Elab' aux Type
246get_type tm = do ctxt <- get_context
246get_type tm = do ctxt <- get_context
247 env <- get_env
247 env <- get_env
@@ -254,7 +254,7 @@ get_type_val tm = do ctxt <- get_context
254 (val, ty) <- lift $ check ctxt env tm
254 (val, ty) <- lift $ check ctxt env tm
255 return $! (finalise val, finalise ty)
255 return $! (finalise val, finalise ty)
257−-- get holes we've deferred for later definition
257+-- | get holes we've deferred for later definition
258get_deferred :: Elab' aux [Name]
258get_deferred :: Elab' aux [Name]
259get_deferred = do ES p _ _ <- get
259get_deferred = do ES p _ _ <- get
260 return $! (deferred (fst p))
260 return $! (deferred (fst p))
@@ -271,17 +271,18 @@ checkInjective (tm, l, r) = do ctxt <- get_context
271 isInj ctxt (Bind _ (Pi _ _ _) sc) = True
271 isInj ctxt (Bind _ (Pi _ _ _) sc) = True
272 isInj ctxt _ = False
272 isInj ctxt _ = False
274−-- get instance argument names
274+-- | get instance argument names
275get_instances :: Elab' aux [Name]
275get_instances :: Elab' aux [Name]
276get_instances = do ES p _ _ <- get
276get_instances = do ES p _ _ <- get
277 return $! (instances (fst p))
277 return $! (instances (fst p))
279−-- get auto argument names
279+-- | get auto argument names
280get_autos :: Elab' aux [(Name, [Name])]
280get_autos :: Elab' aux [(Name, [Name])]
281get_autos = do ES p _ _ <- get
281get_autos = do ES p _ _ <- get
282 return $! (autos (fst p))
282 return $! (autos (fst p))
284−-- given a desired hole name, return a unique hole name
284+-- | given a desired hole name, return a unique hole name
285+unique_hole :: Name -> Elab' aux Name
285unique_hole = unique_hole' False
286unique_hole = unique_hole' False
287unique_hole' :: Bool -> Name -> Elab' aux Name
288unique_hole' :: Bool -> Name -> Elab' aux Name