@@ -38,10 +38,10 @@ converts ctxt env x y
3838
3939errEnv = map (\(x, b) -> (x, binderTy b))
4040
41−isSet :: Context -> Env -> Term -> TC ()
42−isSet ctxt env tm = isSet' (normalise ctxt env tm)
43− where isSet' (Set _) = return ()
44− isSet' tm = fail (showEnv env tm ++ " is not a Set")
41+isType :: Context -> Env -> Term -> TC ()
42+isType ctxt env tm = isType' (normalise ctxt env tm)
43+ where isType' (TType _) = return ()
44+ isType' tm = fail (showEnv env tm ++ " is not a TType")
4545
4646recheck :: Context -> Env -> Raw -> Term -> TC (Term, Type, UCs)
4747recheck ctxt env tm orig
@@ -87,12 +87,12 @@ check' holes ctxt env top = chk env top where
8787 where renameBinders i (Bind x (Pi s) t) = Bind (MN i "binder") (Pi s)
8888 (renameBinders (i+1) t)
8989 renameBinders i sc = sc
90− chk env RSet
91− | holes = return (Set (UVal 0), Set (UVal 0))
90+ chk env RType
91+ | holes = return (TType (UVal 0), TType (UVal 0))
9292 | otherwise = do (v, cs) <- get
9393 let c = ULT (UVar v) (UVar (v+1))
9494 put (v+2, (c:cs))
95− return (Set (UVar v), Set (UVar (v+1)))
95+ return (TType (UVar v), TType (UVar (v+1)))
9696 chk env (RConstant Forgot) = return (Erased, Erased)
9797 chk env (RConstant c) = return (Constant c, constType c)
9898 where constType (I _) = Constant IType
@@ -103,18 +103,18 @@ check' holes ctxt env top = chk env top where
103103 constType (W8 _) = Constant W8Type
104104 constType (W16 _) = Constant W16Type
105105 constType Forgot = Erased
106− constType _ = Set (UVal 0)
106+ constType _ = TType (UVal 0)
107107 chk env (RForce t) = do (_, ty) <- chk env t
108108 return (Erased, ty)
109109 chk env (RBind n (Pi s) t)
110110 = do (sv, st) <- chk env s
111111 (tv, tt) <- chk ((n, Pi sv) : env) t
112112 (v, cs) <- get
113− let Set su = normalise ctxt env st
114− let Set tu = normalise ctxt env tt
113+ let TType su = normalise ctxt env st
114+ let TType tu = normalise ctxt env tt
115115 when (not holes) $ put (v+1, ULE su (UVar v):ULE tu (UVar v):cs)
116116 return (Bind n (Pi (uniqueBinders (map fst env) sv))
117− (pToV n tv), Set (UVar v))
117+ (pToV n tv), TType (UVar v))
118118 chk env (RBind n b sc)
119119 = do b' <- checkBinder b
120120 (scv, sct) <- chk ((n, b'):env) sc
@@ -123,13 +123,13 @@ check' holes ctxt env top = chk env top where
123123 = do (tv, tt) <- chk env t
124124 let tv' = normalise ctxt env tv
125125 let tt' = normalise ctxt env tt
126− lift $ isSet ctxt env tt'
126+ lift $ isType ctxt env tt'
127127 return (Lam tv)
128128 checkBinder (Pi t)
129129 = do (tv, tt) <- chk env t
130130 let tv' = normalise ctxt env tv
131131 let tt' = normalise ctxt env tt
132− lift $ isSet ctxt env tt'
132+ lift $ isType ctxt env tt'
133133 return (Pi tv)
134134 checkBinder (Let t v)
135135 = do (tv, tt) <- chk env t
@@ -137,7 +137,7 @@ check' holes ctxt env top = chk env top where
137137 let tv' = normalise ctxt env tv
138138 let tt' = normalise ctxt env tt
139139 convertsC ctxt env vt tv
140− lift $ isSet ctxt env tt'
140+ lift $ isType ctxt env tt'
141141 return (Let tv vv)
142142 checkBinder (NLet t v)
143143 = do (tv, tt) <- chk env t
@@ -145,7 +145,7 @@ check' holes ctxt env top = chk env top where
145145 let tv' = normalise ctxt env tv
146146 let tt' = normalise ctxt env tt
147147 convertsC ctxt env vt tv
148− lift $ isSet ctxt env tt'
148+ lift $ isType ctxt env tt'
149149 return (NLet tv vv)
150150 checkBinder (Hole t)
151151 | not holes = lift $ tfail (IncompleteTerm undefined)
@@ -153,13 +153,13 @@ check' holes ctxt env top = chk env top where
153153 = do (tv, tt) <- chk env t
154154 let tv' = normalise ctxt env tv
155155 let tt' = normalise ctxt env tt
156− lift $ isSet ctxt env tt'
156+ lift $ isType ctxt env tt'
157157 return (Hole tv)
158158 checkBinder (GHole t)
159159 = do (tv, tt) <- chk env t
160160 let tv' = normalise ctxt env tv
161161 let tt' = normalise ctxt env tt
162− lift $ isSet ctxt env tt'
162+ lift $ isType ctxt env tt'
163163 return (GHole tv)
164164 checkBinder (Guess t v)
165165 | not holes = lift $ tfail (IncompleteTerm undefined)
@@ -169,19 +169,19 @@ check' holes ctxt env top = chk env top where
169169 let tv' = normalise ctxt env tv
170170 let tt' = normalise ctxt env tt
171171 convertsC ctxt env vt tv
172− lift $ isSet ctxt env tt'
172+ lift $ isType ctxt env tt'
173173 return (Guess tv vv)
174174 checkBinder (PVar t)
175175 = do (tv, tt) <- chk env t
176176 let tv' = normalise ctxt env tv
177177 let tt' = normalise ctxt env tt
178− lift $ isSet ctxt env tt'
178+ lift $ isType ctxt env tt'
179179 return (PVar tv)
180180 checkBinder (PVTy t)
181181 = do (tv, tt) <- chk env t
182182 let tv' = normalise ctxt env tv
183183 let tt' = normalise ctxt env tt
184− lift $ isSet ctxt env tt'
184+ lift $ isType ctxt env tt'
185185 return (PVTy tv)
186186
187187 discharge n (Lam t) scv sct
@@ -221,17 +221,17 @@ checkProgram :: Context -> RProgram -> TC Context
221221checkProgram ctxt [] = return ctxt
222222checkProgram ctxt ((n, RConst t) : xs)
223223 = do (t', tt') <- trace (show n) $ check ctxt [] t
224− isSet ctxt [] tt'
224+ isType ctxt [] tt'
225225 checkProgram (addTyDecl n t' ctxt) xs
226226checkProgram ctxt ((n, RFunction (RawFun ty val)) : xs)
227227 = do (ty', tyt') <- trace (show n) $ check ctxt [] ty
228228 (val', valt') <- check ctxt [] val
229− isSet ctxt [] tyt'
229+ isType ctxt [] tyt'
230230 converts ctxt [] ty' valt'
231231 checkProgram (addToCtxt n val' ty' ctxt) xs
232232checkProgram ctxt ((n, RData (RDatatype _ ty cons)) : xs)
233233 = do (ty', tyt') <- trace (show n) $ check ctxt [] ty
234− isSet ctxt [] tyt'
234+ isType ctxt [] tyt'
235235 -- add the tycon temporarily so we can check constructors
236236 let ctxt' = addDatatype (Data n 0 ty' []) ctxt
237237 cons' <- mapM (checkCon ctxt') cons