2
module Agda.TypeChecking.Empty where
4
import Control.Applicative
6
import Agda.Syntax.Common
7
import Agda.Syntax.Internal
9
import Agda.TypeChecking.Monad
10
import Agda.TypeChecking.Coverage
11
import Agda.TypeChecking.Constraints
12
import Agda.TypeChecking.Reduce
14
import Agda.Utils.Permutation
15
import Agda.Utils.Size
17
-- | Make sure that a type is empty.
18
isEmptyType :: MonadTCM tcm => Type -> tcm ()
19
isEmptyType t = noConstraints $ isEmptyTypeC t
21
isEmptyTypeC :: MonadTCM tcm => Type -> tcm Constraints
24
let t = ignoreBlocking tb
26
NotBlocked MetaV{} -> buildConstraint (IsEmpty t)
27
Blocked{} -> buildConstraint (IsEmpty t)
29
tel0 <- getContextTelescope
30
let tel = telFromList $ telToList tel0 ++ [Arg NotHidden ("_", t)]
31
ps = [ Arg h $ VarP x | Arg h (x, _) <- telToList tel ]
33
r <- split tel (idP $ size tel) ps 0
36
Left err -> typeError $ ShouldBeEmpty t []
38
Right cs -> typeError $ ShouldBeEmpty t $ map (unArg . last . scPats) cs