@@ -38,10 +38,10 @@ toplevel = EInfo [] emptyContext id Nothing
39-- Also find deferred names in the term and their types
39-- Also find deferred names in the term and their types
41−build :: IState -> ElabInfo -> Bool -> Name -> PTerm ->
41+build :: IState -> ElabInfo -> Bool -> FnOpts -> Name -> PTerm ->
42 ElabD (Term, [(Name, (Int, Maybe Name, Type))], [PDecl])
42 ElabD (Term, [(Name, (Int, Maybe Name, Type))], [PDecl])
43−build ist info pattern fn tm
43+build ist info pattern opts fn tm
44− = do elab ist info pattern False fn tm
44+ = do elab ist info pattern opts fn tm
45 ivs <- get_instances
45 ivs <- get_instances
46 hs <- get_holes
46 hs <- get_holes
47 ptm <- get_term
47 ptm <- get_term
@@ -78,10 +78,10 @@ build ist info pattern fn tm
78-- (Separate, so we don't go overboard resolving things that we don't
78-- (Separate, so we don't go overboard resolving things that we don't
79-- know about yet on the LHS of a pattern def)
79-- know about yet on the LHS of a pattern def)
81−buildTC :: IState -> ElabInfo -> Bool -> Bool -> Name -> PTerm ->
81+buildTC :: IState -> ElabInfo -> Bool -> FnOpts -> Name -> PTerm ->
82 ElabD (Term, [(Name, (Int, Maybe Name, Type))], [PDecl])
82 ElabD (Term, [(Name, (Int, Maybe Name, Type))], [PDecl])
83−buildTC ist info pattern tcgen fn tm
83+buildTC ist info pattern opts fn tm
84− = do elab ist info pattern tcgen fn tm
84+ = do elab ist info pattern opts fn tm
85 probs <- get_probs
85 probs <- get_probs
86 tm <- get_term
86 tm <- get_term
87 case probs of
87 case probs of
@@ -97,19 +97,22 @@ buildTC ist info pattern tcgen fn tm
97-- Returns the set of declarations we need to add to complete the definition
97-- Returns the set of declarations we need to add to complete the definition
98-- (most likely case blocks to elaborate)
98-- (most likely case blocks to elaborate)
100−elab :: IState -> ElabInfo -> Bool -> Bool -> Name -> PTerm ->
100+elab :: IState -> ElabInfo -> Bool -> FnOpts -> Name -> PTerm ->
102−elab ist info pattern tcgen fn tm
102+elab ist info pattern opts fn tm
103 = do let loglvl = opt_logLevel (idris_options ist)
103 = do let loglvl = opt_logLevel (idris_options ist)
104 when (loglvl > 5) $ unifyLog True
104 when (loglvl > 5) $ unifyLog True
105 compute -- expand type synonyms, etc
105 compute -- expand type synonyms, etc
106− elabE (False, False) tm -- (in argument, guarded)
106+ elabE (False, False, False) tm -- (in argument, guarded, in type)
107 end_unify
107 end_unify
108 when pattern -- convert remaining holes to pattern vars
108 when pattern -- convert remaining holes to pattern vars
109 (do update_term orderPats
109 (do update_term orderPats
110 tm <- get_term
110 tm <- get_term
113+ tcgen = Dictionary `elem` opts
114+ reflect = Reflection `elem` opts
113 isph arg = case getTm arg of
116 isph arg = case getTm arg of
114 Placeholder -> (True, priority arg)
117 Placeholder -> (True, priority arg)
115 _ -> (False, priority arg)
118 _ -> (False, priority arg)
@@ -128,6 +131,7 @@ elab ist info pattern tcgen fn tm
128 (h: hs) -> do patvar h; mkPat
131 (h: hs) -> do patvar h; mkPat
129 [] -> return ()
132 [] -> return ()
134+ elabE :: (Bool, Bool, Bool) -> PTerm -> ElabD ()
131 elabE ina t = {- do g <- goal
135 elabE ina t = {- do g <- goal
132 tm <- get_term
136 tm <- get_term
133 trace ("Elaborating " ++ show t ++ " : " ++ show g ++ "\n\tin " ++ show tm)
137 trace ("Elaborating " ++ show t ++ " : " ++ show g ++ "\n\tin " ++ show tm)
@@ -147,9 +151,18 @@ elab ist info pattern tcgen fn tm
148 local f = do e <- get_env
152 local f = do e <- get_env
149 return (f `elem` map fst e)
153 return (f `elem` map fst e)
155+ constType (AType _) = True
156+ constType StrType = True
157+ constType PtrType = True
158+ constType VoidType = True
151 elab' ina (PNoImplicits t) = elab' ina t -- skip elabE step
161 elab' ina (PNoImplicits t) = elab' ina t -- skip elabE step
152 elab' ina PType = do apply RType []; solve
162 elab' ina PType = do apply RType []; solve
163+ elab' (_,_,inty) (PConstant c)
164+ | constType c && pattern && not reflect && not inty
165+ = lift $ tfail (Msg "Typecase is not allowed")
153 elab' ina (PConstant c) = do apply (RConstant c) []; solve
166 elab' ina (PConstant c) = do apply (RConstant c) []; solve
154 elab' ina (PQuote r) = do fill r; solve
167 elab' ina (PQuote r) = do fill r; solve
155 elab' ina (PTrue fc) = try (elab' ina (PRef fc unitCon))
168 elab' ina (PTrue fc) = try (elab' ina (PRef fc unitCon))
@@ -171,13 +184,13 @@ elab ist info pattern tcgen fn tm
171 [pimp (MN 0 "a") Placeholder True,
184 [pimp (MN 0 "a") Placeholder True,
172 pimp (MN 0 "b") Placeholder False,
185 pimp (MN 0 "b") Placeholder False,
173 pexp l, pexp r])
186 pexp l, pexp r])
174− elab' ina@(_, a) (PPair fc l r)
187+ elab' ina@(_, a, inty) (PPair fc l r)
175 = do hnf_compute
188 = do hnf_compute
176 g <- goal
189 g <- goal
177 case g of
190 case g of
178− TType _ -> elabE (True, a) (PApp fc (PRef fc pairTy)
191+ TType _ -> elabE (True, a,inty) (PApp fc (PRef fc pairTy)
179− [pexp l,pexp r])
192+ [pexp l,pexp r])
180− _ -> elabE (True, a) (PApp fc (PRef fc pairCon)
193+ _ -> elabE (True, a, inty) (PApp fc (PRef fc pairCon)
181 [pimp (MN 0 "A") Placeholder True,
194 [pimp (MN 0 "A") Placeholder True,
182 pimp (MN 0 "B") Placeholder True,
195 pimp (MN 0 "B") Placeholder True,
183 pexp l, pexp r])
196 pexp l, pexp r])
@@ -225,7 +238,10 @@ elab ist info pattern tcgen fn tm
225 trySeq' deferr (x : xs)
238 trySeq' deferr (x : xs)
226 = try' (elab' ina x) (trySeq' deferr xs) True
239 = try' (elab' ina x) (trySeq' deferr xs) True
227 elab' ina (PPatvar fc n) | pattern = patvar n
240 elab' ina (PPatvar fc n) | pattern = patvar n
241+ elab' (_, _, inty) (PRef fc f)
242+ | isTConName f (tt_ctxt ist) && pattern && not reflect && not inty
243+ = lift $ tfail (Msg "Typecase is not allowed")
228− elab' (ina, guarded) (PRef fc n) | pattern && not (inparamBlock n)
244+ elab' (ina, guarded, inty) (PRef fc n) | pattern && not (inparamBlock n)
229 = do ctxt <- get_context
245 = do ctxt <- get_context
230 let defined = case lookupTy n ctxt of
246 let defined = case lookupTy n ctxt of
231 [] -> False
247 [] -> False
@@ -242,7 +258,7 @@ elab ist info pattern tcgen fn tm
242 _ -> True
258 _ -> True
243 elab' ina f@(PInferRef fc n) = elab' ina (PApp fc f [])
259 elab' ina f@(PInferRef fc n) = elab' ina (PApp fc f [])
244 elab' ina (PRef fc n) = erun fc $ do apply (Var n) []; solve
260 elab' ina (PRef fc n) = erun fc $ do apply (Var n) []; solve
245− elab' ina@(_, a) (PLam n Placeholder sc)
261+ elab' ina@(_, a, inty) (PLam n Placeholder sc)
246 = do -- n' <- unique_hole n
262 = do -- n' <- unique_hole n
247 -- let sc' = mapPT (repN n n') sc
263 -- let sc' = mapPT (repN n n') sc
248 ptm <- get_term
264 ptm <- get_term
@@ -250,10 +266,10 @@ elab ist info pattern tcgen fn tm
250 checkPiGoal n
266 checkPiGoal n
251 attack; intro (Just n);
267 attack; intro (Just n);
252 -- trace ("------ intro " ++ show n ++ " ---- \n" ++ show ptm)
268 -- trace ("------ intro " ++ show n ++ " ---- \n" ++ show ptm)
253− elabE (True, a) sc; solve
269+ elabE (True, a, inty) sc; solve
254 where repN n n' (PRef fc x) | x == n' = PRef fc n'
270 where repN n n' (PRef fc x) | x == n' = PRef fc n'
255 repN _ _ t = t
271 repN _ _ t = t
256− elab' ina@(_, a) (PLam n ty sc)
272+ elab' ina@(_, a, inty) (PLam n ty sc)
257 = do hsin <- get_holes
273 = do hsin <- get_holes
258 ptmin <- get_term
274 ptmin <- get_term
259 tyn <- unique_hole (MN 0 "lamty")
275 tyn <- unique_hole (MN 0 "lamty")
@@ -268,12 +284,12 @@ elab ist info pattern tcgen fn tm
268 introTy (Var tyn) (Just n)
284 introTy (Var tyn) (Just n)
269 -- end_unify
285 -- end_unify
270 focus tyn
286 focus tyn
271− elabE (True, a) ty
287+ elabE (True, a, True) ty
272− elabE (True, a) sc
288+ elabE (True, a, inty) sc
274− elab' ina@(_,a) (PPi _ n Placeholder sc)
290+ elab' ina@(_, a, _) (PPi _ n Placeholder sc)
275− = do attack; arg n (MN 0 "ty"); elabE (True, a) sc; solve
291+ = do attack; arg n (MN 0 "ty"); elabE (True, a, True) sc; solve
276− elab' ina@(_,a) (PPi _ n ty sc)
292+ elab' ina@(_, a, _) (PPi _ n ty sc)
277 = do attack; tyn <- unique_hole (MN 0 "ty")
293 = do attack; tyn <- unique_hole (MN 0 "ty")
278 claim tyn RType
294 claim tyn RType
279 n' <- case n of
295 n' <- case n of
@@ -281,10 +297,10 @@ elab ist info pattern tcgen fn tm
281 _ -> return n
297 _ -> return n
282 forall n' (Var tyn)
298 forall n' (Var tyn)
283 focus tyn
299 focus tyn
284− elabE (True, a) ty
300+ elabE (True, a, True) ty
285− elabE (True, a) sc
301+ elabE (True, a, True) sc
287− elab' ina@(_,a) (PLet n ty val sc)
303+ elab' ina@(_, a, inty) (PLet n ty val sc)
288 = do attack;
304 = do attack;
289 tyn <- unique_hole (MN 0 "letty")
305 tyn <- unique_hole (MN 0 "letty")
290 claim tyn RType
306 claim tyn RType
@@ -296,17 +312,17 @@ elab ist info pattern tcgen fn tm
296 Placeholder -> return ()
312 Placeholder -> return ()
297 _ -> do focus tyn
313 _ -> do focus tyn
298 explicit tyn
314 explicit tyn
299− elabE (True, a) ty
315+ elabE (True, a, True) ty
300 focus valn
316 focus valn
301− elabE (True, a) val
317+ elabE (True, a, True) val
302 env <- get_env
318 env <- get_env
303− elabE (True, a) sc
319+ elabE (True, a, inty) sc
304 -- HACK: If the name leaks into its type, it may leak out of
320 -- HACK: If the name leaks into its type, it may leak out of
305 -- scope outside, so substitute in the outer scope.
321 -- scope outside, so substitute in the outer scope.
306 expandLet n (case lookup n env of
322 expandLet n (case lookup n env of
307 Just (Let t v) -> v)
323 Just (Let t v) -> v)
309− elab' ina@(_,a) (PGoal fc r n sc) = do
325+ elab' ina@(_, a, inty) (PGoal fc r n sc) = do
310 rty <- goal
326 rty <- goal
312 tyn <- unique_hole (MN 0 "letty")
328 tyn <- unique_hole (MN 0 "letty")
@@ -315,10 +331,10 @@ elab ist info pattern tcgen fn tm
315 claim valn (Var tyn)
331 claim valn (Var tyn)
316 letbind n (Var tyn) (Var valn)
332 letbind n (Var tyn) (Var valn)
317 focus valn
333 focus valn
318− elabE (True, a) (PApp fc r [pexp (delab ist rty)])
334+ elabE (True, a, True) (PApp fc r [pexp (delab ist rty)])
319 env <- get_env
335 env <- get_env
320 computeLet n
336 computeLet n
321− elabE (True, a) sc
337+ elabE (True, a, inty) sc
323-- elab' ina (PLet n Placeholder
339-- elab' ina (PLet n Placeholder
324-- (PApp fc r [pexp (delab ist rty)]) sc)
340-- (PApp fc r [pexp (delab ist rty)]) sc)
@@ -368,14 +384,17 @@ elab ist info pattern tcgen fn tm
368 Just xs@(_:_) -> NS n xs
384 Just xs@(_:_) -> NS n xs
371− elab' (ina, g) (PMatchApp fc fn)
387+ elab' ina (PMatchApp fc fn)
372 = do (fn', imps) <- case lookupCtxtName fn (idris_implicits ist) of
388 = do (fn', imps) <- case lookupCtxtName fn (idris_implicits ist) of
373 [(n, args)] -> return (n, map (const True) args)
389 [(n, args)] -> return (n, map (const True) args)
374 _ -> lift $ tfail (NoSuchVariable fn)
390 _ -> lift $ tfail (NoSuchVariable fn)
375 ns <- match_apply (Var fn') (map (\x -> (x,0)) imps)
391 ns <- match_apply (Var fn') (map (\x -> (x,0)) imps)
393+ elab' (_, _, inty) (PApp fc (PRef _ f) args')
394+ | isTConName f (tt_ctxt ist) && pattern && not reflect && not inty
395+ = lift $ tfail (Msg "Typecase is not allowed")
377 -- if f is local, just do a simple_app
396 -- if f is local, just do a simple_app
378− elab' (ina, g) tm@(PApp fc (PRef _ f) args')
397+ elab' (ina, g, inty) tm@(PApp fc (PRef _ f) args')
379 = do let args = {- case lookupCtxt f (inblock info) of
398 = do let args = {- case lookupCtxt f (inblock info) of
380 Just ps -> (map (pexp . (PRef fc)) ps ++ args')
399 Just ps -> (map (pexp . (PRef fc)) ps ++ args')
381 _ -> -} args'
400 _ -> -} args'
@@ -383,8 +402,8 @@ elab ist info pattern tcgen fn tm
383 env <- get_env
402 env <- get_env
384 if (f `elem` map fst env && length args' == 1)
403 if (f `elem` map fst env && length args' == 1)
385 then -- simple app, as below
404 then -- simple app, as below
386− do simple_app (elabE (ina, g) (PRef fc f))
405+ do simple_app (elabE (ina, g, inty) (PRef fc f))
387− (elabE (True, g) (getTm (head args')))
406+ (elabE (True, g, inty) (getTm (head args')))
388 (show tm)
407 (show tm)
@@ -408,7 +427,7 @@ elab ist info pattern tcgen fn tm
408 sortBy (\(_,x) (_,y) ->
427 sortBy (\(_,x) (_,y) ->
409 compare (priority x) (priority y))
428 compare (priority x) (priority y))
410 (zip ns args)
429 (zip ns args)
411− elabArgs (ina || not isinf, guarded)
430+ elabArgs (ina || not isinf, guarded, inty)
412 [] fc False ns' (map (\x -> (lazyarg x, getTm x)) eargs)
431 [] fc False ns' (map (\x -> (lazyarg x, getTm x)) eargs)
413 mkSpecialised ist fc f (map getTm args') tm
432 mkSpecialised ist fc f (map getTm args') tm
@@ -439,9 +458,9 @@ elab ist info pattern tcgen fn tm
439 setInjective (PApp _ (PRef _ n) _) = setinj n
458 setInjective (PApp _ (PRef _ n) _) = setinj n
440 setInjective _ = return ()
459 setInjective _ = return ()
442− elab' ina@(_, a) tm@(PApp fc f [arg])
461+ elab' ina@(_, a, inty) tm@(PApp fc f [arg])
443 = erun fc $
462 = erun fc $
444− do simple_app (elabE ina f) (elabE (True, a) (getTm arg))
463+ do simple_app (elabE ina f) (elabE (True, a, inty) (getTm arg))
445 (show tm)
464 (show tm)
447 elab' ina Placeholder = do (h : hs) <- get_holes
466 elab' ina Placeholder = do (h : hs) <- get_holes
@@ -490,7 +509,7 @@ elab ist info pattern tcgen fn tm
490 elab' ina sc
509 elab' ina sc
491 elab' ina (PRef fc letn)
510 elab' ina (PRef fc letn)
493− elab' ina@(_, a) c@(PCase fc scr opts)
512+ elab' ina@(_, a, inty) c@(PCase fc scr opts)
494 = do attack
513 = do attack
495 tyn <- unique_hole (MN 0 "scty")
514 tyn <- unique_hole (MN 0 "scty")
496 claim tyn RType
515 claim tyn RType
@@ -499,7 +518,7 @@ elab ist info pattern tcgen fn tm
499 claim valn (Var tyn)
518 claim valn (Var tyn)
500 letbind scvn (Var tyn) (Var valn)
519 letbind scvn (Var tyn) (Var valn)
501 focus valn
520 focus valn
502− elabE (True, a) scr
521+ elabE (True, a, inty) scr
503 args <- get_env
522 args <- get_env
504 cname <- unique_hole' True (mkCaseName fn)
523 cname <- unique_hole' True (mkCaseName fn)
505 let cname' = mkN cname
524 let cname' = mkN cname
@@ -682,9 +701,9 @@ findInstances ist t
682 | otherwise = []
701 | otherwise = []
684trivial' ist
703trivial' ist
685− = trivial (elab ist toplevel False False (MN 0 "tac")) ist
704+ = trivial (elab ist toplevel False [] (MN 0 "tac")) ist
686proofSearch' ist top n hints
705proofSearch' ist top n hints
687− = proofSearch (elab ist toplevel False False (MN 0 "tac")) top n hints ist
706+ = proofSearch (elab ist toplevel False [] (MN 0 "tac")) top n hints ist
690resolveTC :: Int -> Term -> Name -> IState -> ElabD ()
709resolveTC :: Int -> Term -> Name -> IState -> ElabD ()
@@ -813,7 +832,7 @@ runTac autoSolve ist tac
814 bname (Bind n _ _) = Just n
833 bname (Bind n _ _) = Just n
815 bname _ = Nothing
834 bname _ = Nothing
816− runT (Exact tm) = do elab ist toplevel False False (MN 0 "tac") tm
835+ runT (Exact tm) = do elab ist toplevel False [] (MN 0 "tac") tm
817 when autoSolve solveAll
836 when autoSolve solveAll
818 runT (MatchRefine fn)
837 runT (MatchRefine fn)
819 = do fnimps <-
838 = do fnimps <-
@@ -860,7 +879,7 @@ runTac autoSolve ist tac
860 letn <- unique_hole (MN 0 "equiv_val")
879 letn <- unique_hole (MN 0 "equiv_val")
861 letbind letn (Var tyn) (Var valn)
880 letbind letn (Var tyn) (Var valn)
862 focus tyn
881 focus tyn
863− elab ist toplevel False False (MN 0 "tac") tm
882+ elab ist toplevel False [] (MN 0 "tac") tm
864 focus valn
883 focus valn
865 when autoSolve solveAll
884 when autoSolve solveAll
866 runT (Rewrite tm) -- to elaborate tm, let bind it, then rewrite by that
885 runT (Rewrite tm) -- to elaborate tm, let bind it, then rewrite by that
@@ -873,7 +892,7 @@ runTac autoSolve ist tac
873 letn <- unique_hole (MN 0 "rewrite_rule")
892 letn <- unique_hole (MN 0 "rewrite_rule")
874 letbind letn (Var tyn) (Var valn)
893 letbind letn (Var tyn) (Var valn)
875 focus valn
894 focus valn
876− elab ist toplevel False False (MN 0 "tac") tm
895+ elab ist toplevel False [] (MN 0 "tac") tm
877 rewrite (Var letn)
896 rewrite (Var letn)
878 when autoSolve solveAll
897 when autoSolve solveAll
879 runT (Induction nm)
898 runT (Induction nm)
@@ -888,7 +907,7 @@ runTac autoSolve ist tac
888 letn <- unique_hole n
907 letn <- unique_hole n
889 letbind letn (Var tyn) (Var valn)
908 letbind letn (Var tyn) (Var valn)
890 focus valn
909 focus valn
891− elab ist toplevel False False (MN 0 "tac") tm
910+ elab ist toplevel False [] (MN 0 "tac") tm
892 when autoSolve solveAll
911 when autoSolve solveAll
893 runT (LetTacTy n ty tm)
912 runT (LetTacTy n ty tm)
894 = do attack
913 = do attack
@@ -899,9 +918,9 @@ runTac autoSolve ist tac
899 letn <- unique_hole n
918 letn <- unique_hole n
900 letbind letn (Var tyn) (Var valn)
919 letbind letn (Var tyn) (Var valn)
901 focus tyn
920 focus tyn
902− elab ist toplevel False False (MN 0 "tac") ty
921+ elab ist toplevel False [] (MN 0 "tac") ty
903 focus valn
922 focus valn
904− elab ist toplevel False False (MN 0 "tac") tm
923+ elab ist toplevel False [] (MN 0 "tac") tm
905 when autoSolve solveAll
924 when autoSolve solveAll
906 runT Compute = compute
925 runT Compute = compute
907 runT Trivial = do trivial' ist; when autoSolve solveAll
926 runT Trivial = do trivial' ist; when autoSolve solveAll
@@ -919,7 +938,7 @@ runTac autoSolve ist tac
919 scriptvar <- unique_hole (MN 0 "scriptvar" )
938 scriptvar <- unique_hole (MN 0 "scriptvar" )
920 letbind scriptvar scriptTy (Var script)
939 letbind scriptvar scriptTy (Var script)
921 focus script
940 focus script
922− elab ist toplevel False False (MN 0 "tac") tm
941+ elab ist toplevel False [] (MN 0 "tac") tm
923 (script', _) <- get_type_val (Var scriptvar)
942 (script', _) <- get_type_val (Var scriptvar)
924 -- now that we have the script apply
943 -- now that we have the script apply
925 -- it to the reflected goal and context
944 -- it to the reflected goal and context
@@ -952,7 +971,7 @@ runTac autoSolve ist tac
952 letbind scriptvar scriptTy (Var script)
971 letbind scriptvar scriptTy (Var script)
953 focus script
972 focus script
954 ptm <- get_term
973 ptm <- get_term
955− elab ist toplevel False False (MN 0 "tac")
974+ elab ist toplevel False [] (MN 0 "tac")
956 (PApp emptyFC tm [pexp (delabTy' ist [] tgoal True True)])
975 (PApp emptyFC tm [pexp (delabTy' ist [] tgoal True True)])
957 (script', _) <- get_type_val (Var scriptvar)
976 (script', _) <- get_type_val (Var scriptvar)
958 -- now that we have the script apply
977 -- now that we have the script apply
@@ -980,7 +999,7 @@ runTac autoSolve ist tac
980 letn <- unique_hole (MN 0 "letvar")
999 letn <- unique_hole (MN 0 "letvar")
981 letbind letn (Var tyn) (Var valn)
1000 letbind letn (Var tyn) (Var valn)
982 focus valn
1001 focus valn
983− elab ist toplevel False False (MN 0 "tac") v
1002+ elab ist toplevel False [] (MN 0 "tac") v
984 (value, _) <- get_type_val (Var letn)
1003 (value, _) <- get_type_val (Var letn)
985 ctxt <- get_context
1004 ctxt <- get_context
986 env <- get_env
1005 env <- get_env
@@ -994,7 +1013,7 @@ runTac autoSolve ist tac
994 letn <- unique_hole (MN 0 "letvar")
1013 letn <- unique_hole (MN 0 "letvar")
995 letbind letn (Var tyn) (Var valn)
1014 letbind letn (Var tyn) (Var valn)
996 focus valn
1015 focus valn
997− elab ist toplevel False False (MN 0 "tac") v
1016+ elab ist toplevel False [] (MN 0 "tac") v
998 (value, _) <- get_type_val (Var letn)
1017 (value, _) <- get_type_val (Var letn)
999 ctxt <- get_context
1018 ctxt <- get_context
1000 env <- get_env
1019 env <- get_env