1{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies, DeriveFunctor #-}
5import Control.Monad.State
7import qualified Data.Map as Map
10import qualified Data.Binary as B
11import Data.Binary hiding (get, put)
13import Util.Pretty hiding (Str)
16 * Full dependent types
17 * A hierarchy of universes, with cumulativity: Set : Set1, Set1 : Set2, ...
18 * Pattern matching letrec binding
19 * (primitive types defined externally)
22 * Typechecker is kept as simple as possible
23 - no unification, just a checker for incomplete terms.
24 * We have a simple collection of tactics which we use to elaborate source
25 programs with implicit syntax into fully explicit terms.
32data FC = FC { fc_fname :: String,
36deriving instance Binary FC
39instance Sized FC where
40 size (FC f l) = 1 + length f
43 show (FC f l) = f ++ ":" ++ show l
47 | CantUnify Bool Term Term Err [(Name, Type)] Int
48 -- Int is 'score' - how much we did unify
49 -- Bool indicates recoverability, True indicates more info may make
50 -- unification succeed
53 | NotInjective Term Term Term
55 | CantResolveAlts [String]
63instance Sized Err where
64 size (Msg msg) = length msg
65 size (InternalMsg msg) = length msg
66 size (CantUnify _ left right err _ score) = size left + size right + size err
67 size (NoSuchVariable name) = size name
68 size (NoTypeDecl name) = size name
69 size (NotInjective l c r) = size l + size c + size r
70 size (CantResolve trm) = size trm
71 size (CantResolveAlts _) = 1
72 size (IncompleteTerm trm) = size trm
73 size UniverseError = 1
74 size ProgramLineComment = 1
75 size (At fc err) = size fc + size err
76 size (Inaccessible _) = 1
79score (CantUnify _ _ _ m _ s) = s + score m
80score (CantResolve _) = 20
81score (NoSuchVariable _) = 1000
84instance Show Err where
86 show (InternalMsg s) = "Internal error: " ++ show s
87 show (CantUnify _ l r e sc i) = "CantUnify " ++ show l ++ " " ++ show r ++ " "
88 ++ show e ++ " in " ++ show sc ++ " " ++ show i
89 show (Inaccessible n) = show n ++ " is not an accessible pattern variable"
92instance Pretty Err where
93 pretty (Msg m) = text m
94 pretty (CantUnify _ l r e _ i) =
95 if size l + size r > breakingSize then
96 text "Cannot unify" <+> colon $$
97 nest nestingSize (pretty l <+> text "and" <+> pretty r) $$
98 nest nestingSize (text "where" <+> pretty e <+> text "with" <+> (text . show $ i))
100 text "Cannot unify" <+> colon <+> pretty l <+> text "and" <+> pretty r $$
101 nest nestingSize (text "where" <+> pretty e <+> text "with" <+> (text . show $ i))
102 pretty _ = text "Error"
106 deriving (Eq, Functor)
108instance Pretty a => Pretty (TC a) where
109 pretty (OK ok) = pretty ok
111 if size err > breakingSize then
112 text "Error" <+> colon $$ (nest nestingSize $ pretty err)
114 text "Error" <+> colon <+> pretty err
116instance Show a => Show (TC a) where
118 show (Error str) = "Error: " ++ show str
120-- at some point, this instance should also carry type checking options
123instance Monad TC where
128 fail e = Error (InternalMsg e)
133trun :: FC -> TC a -> TC a
135trun fc (Error e) = Error (At fc e)
137instance MonadPlus TC where
138 mzero = fail "Unknown error"
139 (OK x) `mplus` _ = OK x
140 _ `mplus` (OK y) = OK y
143discard :: Monad m => m a -> m ()
144discard f = f >> return ()
146showSep :: String -> [String] -> String
149showSep sep (x:xs) = x ++ sep ++ showSep sep xs
151pmap f (x, y) = (f x, f y)
153traceWhen True msg a = trace msg a
154traceWhen False _ a = a
156-- RAW TERMS ----------------------------------------------------------------
158-- Names are hierarchies of strings, describing scope (so no danger of
159-- duplicate names, but need to be careful on lookup).
160-- Also MN for machine chosen names
163 | NS Name [String] -- root, namespaces
167deriving instance Binary Name
170instance Sized Name where
172 size (NS n els) = 1 + length els
175instance Pretty Name where
176 pretty (UN n) = text n
177 pretty (NS n s) = pretty n
178 pretty (MN i s) = lbrace <+> text s <+> (text . show $ i) <+> rbrace
180instance Show Name where
182 show (NS n s) = showSep "." (reverse s) ++ "." ++ show n
183 show (MN i s) = "{" ++ s ++ show i ++ "}"
186-- Contexts allow us to map names to things. A root name maps to a collection
187-- of things in different namespaces with that name.
189type Ctxt a = Map.Map Name (Map.Map Name a)
190emptyContext = Map.empty
195addDef :: Name -> a -> Ctxt a -> Ctxt a
196addDef n v ctxt = case Map.lookup (nsroot n) ctxt of
197 Nothing -> Map.insert (nsroot n)
198 (Map.insert n v Map.empty) ctxt
199 Just xs -> Map.insert (nsroot n)
200 (Map.insert n v xs) ctxt
202{- lookup a name in the context, given an optional namespace.
203 The name (n) may itself have a (partial) namespace given.
205 Rules for resolution:
206 - if an explicit namespace is given, return the names which match it. If none
207 match, return all names.
208 - if the name has has explicit namespace given, return the names which match it
209 and ignore the given namespace.
210 - otherwise, return all names.
214lookupCtxtName :: Maybe [String] -> Name -> Ctxt a -> [(Name, a)]
215lookupCtxtName nspace n ctxt = case Map.lookup (nsroot n) ctxt of
216 Just xs -> filterNS (Map.toList xs)
220 filterNS ((found, v) : xs)
221 | nsmatch n found = (found, v) : filterNS xs
222 | otherwise = filterNS xs
224 nsmatch (NS n ns) (NS p ps) = ns `isPrefixOf` ps
225 nsmatch (NS _ _) _ = False
226 nsmatch looking found = True
228lookupCtxt :: Maybe [String] -> Name -> Ctxt a -> [a]
229lookupCtxt ns n ctxt = map snd (lookupCtxtName ns n ctxt)
231updateDef :: Name -> (a -> a) -> Ctxt a -> Ctxt a
233 = let ds = lookupCtxtName Nothing n ctxt in
234 foldr (\ (n, t) c -> addDef n (f t) c) ctxt ds
236toAlist :: Ctxt a -> [(Name, a)]
237toAlist ctxt = let allns = map snd (Map.toList ctxt) in
238 concat (map (Map.toList) allns)
240addAlist :: Show a => [(Name, a)] -> Ctxt a -> Ctxt a
241addAlist [] ctxt = ctxt
242addAlist ((n, tm) : ds) ctxt = addDef n tm (addAlist ds ctxt)
244data Const = I Int | BI Integer | Fl Double | Ch Char | Str String
245 | IType | BIType | FlType | ChType | StrType
246 | PtrType | VoidType | Forgot
249deriving instance Binary Const
252instance Sized Const where
255instance Pretty Const where
256 pretty (I i) = text . show $ i
257 pretty (BI i) = text . show $ i
258 pretty (Fl f) = text . show $ f
259 pretty (Ch c) = text . show $ c
260 pretty (Str s) = text s
261 pretty IType = text "Int"
262 pretty BIType = text "BigInt"
263 pretty FlType = text "Float"
264 pretty ChType = text "Char"
265 pretty StrType = text "String"
266 pretty PtrType = text "Ptr"
267 pretty VoidType = text "Void"
268 pretty Forgot = text "Forgot"
271 | RBind Name (Binder Raw) Raw
278instance Sized Raw where
280 size (RBind name bind right) = 1 + size bind + size right
281 size (RApp left right) = 1 + size left + size right
283 size (RForce raw) = 1 + size raw
284 size (RConstant const) = size const
286instance Pretty Raw where
290deriving instance Binary Raw
293data Binder b = Lam { binderTy :: b }
294 | Pi { binderTy :: b }
295 | Let { binderTy :: b,
297 | NLet { binderTy :: b,
299 | Hole { binderTy :: b}
300 | GHole { binderTy :: b}
301 | Guess { binderTy :: b,
303 | PVar { binderTy :: b }
304 | PVTy { binderTy :: b }
305 deriving (Show, Eq, Ord, Functor)
307deriving instance Binary Binder
310instance Sized a => Sized (Binder a) where
311 size (Lam ty) = 1 + size ty
312 size (Pi ty) = 1 + size ty
313 size (Let ty val) = 1 + size ty + size val
314 size (NLet ty val) = 1 + size ty + size val
315 size (Hole ty) = 1 + size ty
316 size (GHole ty) = 1 + size ty
317 size (Guess ty val) = 1 + size ty + size val
318 size (PVar ty) = 1 + size ty
319 size (PVTy ty) = 1 + size ty
321fmapMB :: Monad m => (a -> m b) -> Binder a -> m (Binder b)
322fmapMB f (Let t v) = liftM2 Let (f t) (f v)
323fmapMB f (NLet t v) = liftM2 NLet (f t) (f v)
324fmapMB f (Guess t v) = liftM2 Guess (f t) (f v)
325fmapMB f (Lam t) = liftM Lam (f t)
326fmapMB f (Pi t) = liftM Pi (f t)
327fmapMB f (Hole t) = liftM Hole (f t)
328fmapMB f (GHole t) = liftM GHole (f t)
329fmapMB f (PVar t) = liftM PVar (f t)
330fmapMB f (PVTy t) = liftM PVTy (f t)
332raw_apply :: Raw -> [Raw] -> Raw
334raw_apply f (a : as) = raw_apply (RApp f a) as
336raw_unapply :: Raw -> (Raw, [Raw])
337raw_unapply t = ua [] t where
338 ua args (RApp f a) = ua (a:args) f
339 ua args t = (t, args)
341data RawFun = RawFun { rtype :: Raw,
346data RawDatatype = RDatatype Name Raw [(Name, Raw)]
349data RDef = RFunction RawFun
354type RProgram = [(Name, RDef)]
356-- WELL TYPED TERMS ---------------------------------------------------------
358data UExp = UVar Int -- universe variable
359 | UVal Int -- explicit universe level
362instance Sized UExp where
365-- We assume that universe levels have been checked, so anything external
366-- can just have the same universe variable and we won't get any new
369instance Binary UExp where
371 get = return (UVar (-1))
373instance Show UExp where
374 show (UVar x) | x < 26 = [toEnum (x + fromEnum 'a')]
375 | otherwise = toEnum ((x `mod` 26) + fromEnum 'a') : show (x `div` 26)
376 show (UVal x) = show x
377-- show (UMax l r) = "max(" ++ show l ++ ", " ++ show r ++")"
379data UConstraint = ULT UExp UExp
383instance Show UConstraint where
384 show (ULT x y) = show x ++ " < " ++ show y
385 show (ULE x y) = show x ++ " <= " ++ show y
387type UCs = (Int, [UConstraint])
389data NameType = Bound | Ref | DCon Int Int | TCon Int Int
392deriving instance Binary NameType
395instance Sized NameType where
398instance Pretty NameType where
401instance Eq NameType where
402 Bound == Bound = True
404 DCon _ a == DCon _ b = (a == b) -- ignore tag
405 TCon _ a == TCon _ b = (a == b) -- ignore tag
408data TT n = P NameType n (TT n) -- embed type
410 | Bind n (Binder (TT n)) (TT n)
411 | App (TT n) (TT n) -- function, function type, arg
415 deriving (Ord, Functor)
417deriving instance Binary TT
420instance Sized a => Sized (TT a) where
421 size (P name n trm) = 1 + size name + size n + size trm
423 size (Bind nm binder bdy) = 1 + size nm + size binder + size bdy
424 size (App l r) = 1 + size l + size r
425 size (Constant c) = size c
427 size (Set u) = 1 + size u
429instance Pretty a => Pretty (TT a) where
430 pretty _ = text "test"
432type EnvTT n = [(n, Binder (TT n))]
434data Datatype n = Data { d_typename :: n,
437 d_cons :: [(n, TT n)] }
438 deriving (Show, Functor, Eq)
440instance Eq n => Eq (TT n) where
441 (==) (P xt x _) (P yt y _) = xt == yt && x == y
442 (==) (V x) (V y) = x == y
443 (==) (Bind _ xb xs) (Bind _ yb ys) = xb == yb && xs == ys
444 (==) (App fx ax) (App fy ay) = fx == fy && ax == ay
445 (==) (Set _) (Set _) = True -- deal with constraints later
446 (==) (Constant x) (Constant y) = x == y
451-- A few handy operations on well typed terms:
453isInjective :: TT n -> Bool
454isInjective (P (DCon _ _) _ _) = True
455isInjective (P (TCon _ _) _ _) = True
456isInjective (Constant _) = True
457isInjective (Set x) = True
458isInjective (Bind _ (Pi _) sc) = True
459isInjective (App f a) = isInjective f
462instantiate :: TT n -> TT n -> TT n
463instantiate e = subst 0 where
464 subst i (V x) | i == x = e
465 subst i (Bind x b sc) = Bind x (fmap (subst i) b) (subst (i+1) sc)
466 subst i (App f a) = App (subst i f) (subst i a)
469pToV :: Eq n => n -> TT n -> TT n
471pToV' n i (P _ x _) | n == x = V i
472pToV' n i (Bind x b sc)
473 | n == x = Bind x (fmap (pToV' n i) b) sc
474 | otherwise = Bind x (fmap (pToV' n i) b) (pToV' n (i+1) sc)
475pToV' n i (App f a) = App (pToV' n i f) (pToV' n i a)
478-- Convert several names. First in the list comes out as V 0
479pToVs :: Eq n => [n] -> TT n -> TT n
480pToVs ns tm = pToVs' ns tm 0 where
482 pToVs' (n:ns) tm i = pToV' n i (pToVs' ns tm (i+1))
486 vToP' env (V i) = let (n, b) = (env !! i) in
487 P Bound n (binderTy b)
488 vToP' env (Bind n b sc) = let b' = fmap (vToP' env) b in
489 Bind n b' (vToP' ((n, b'):env) sc)
490 vToP' env (App f a) = App (vToP' env f) (vToP' env a)
493finalise :: Eq n => TT n -> TT n
494finalise (Bind x b sc) = Bind x (fmap finalise b) (pToV x (finalise sc))
495finalise (App f a) = App (finalise f) (finalise a)
498subst :: Eq n => n -> TT n -> TT n -> TT n
499subst n v tm = instantiate v (pToV n tm)
501substNames :: Eq n => [(n, TT n)] -> TT n -> TT n
503substNames ((n, tm) : xs) t = subst n tm (substNames xs t)
505-- Returns true if V 0 and bound name n do not occur in the term
507noOccurrence :: Eq n => n -> TT n -> Bool
508noOccurrence n t = no' 0 t
510 no' i (V x) = not (i == x)
511 no' i (P Bound x _) = not (n == x)
512 no' i (Bind n b sc) = noB' i b && no' (i+1) sc
513 where noB' i (Let t v) = no' i t && no' i v
514 noB' i (Guess t v) = no' i t && no' i v
515 noB' i b = no' i (binderTy b)
516 no' i (App f a) = no' i f && no' i a
519-- Returns all names used free in the term
521freeNames :: Eq n => TT n -> [n]
522freeNames (P _ n _) = [n]
523freeNames (Bind n (Let t v) sc) = nub $ freeNames v ++ (freeNames sc \\ [n])
525freeNames (Bind n b sc) = nub $ freeNames (binderTy b) ++ (freeNames sc \\ [n])
526freeNames (App f a) = nub $ freeNames f ++ freeNames a
529-- Return the arity of a (normalised) type
532arity (Bind n (Pi t) sc) = 1 + arity sc
535-- deconstruct an application; returns the function and a list of arguments
537unApply :: TT n -> (TT n, [TT n])
538unApply t = ua [] t where
539 ua args (App f a) = ua (a:args) f
540 ua args t = (t, args)
542mkApp :: TT n -> [TT n] -> TT n
544mkApp f (a:as) = mkApp (App f a) as
546forget :: TT Name -> Raw
549 fe env (P _ n _) = Var n
550 fe env (V i) = Var (env !! i)
551 fe env (Bind n b sc) = RBind n (fmap (fe env) b)
553 fe env (App f a) = RApp (fe env f) (fe env a)
556 fe env (Set i) = RSet
557 fe env Erased = RConstant Forgot
559bindAll :: [(n, Binder (TT n))] -> TT n -> TT n
561bindAll ((n, b) : bs) t = Bind n b (bindAll bs t)
563bindTyArgs :: (TT n -> Binder (TT n)) -> [(n, TT n)] -> TT n -> TT n
564bindTyArgs b xs = bindAll (map (\ (n, ty) -> (n, b ty)) xs)
566getArgTys :: TT n -> [(n, TT n)]
567getArgTys (Bind n (Pi t) sc) = (n, t) : getArgTys sc
570getRetTy :: TT n -> TT n
571getRetTy (Bind n (PVar _) sc) = getRetTy sc
572getRetTy (Bind n (PVTy _) sc) = getRetTy sc
573getRetTy (Bind n (Pi _) sc) = getRetTy sc
576uniqueName :: Name -> [Name] -> Name
577uniqueName n hs | n `elem` hs = uniqueName (nextName n) hs
580nextName (NS x s) = NS (nextName x) s
581nextName (MN i n) = MN (i+1) n
582nextName (UN x) = let (num', nm') = span isDigit (reverse x)
584 num = readN (reverse num') in
585 UN (nm ++ show (num+1))
595-- an environment with de Bruijn indices 'normalised' so that they all refer to
598newtype WkEnvTT n = Wk (EnvTT n)
599type WkEnv = WkEnvTT Name
601instance (Eq n, Show n) => Show (TT n) where
602 show t = showEnv [] t
604instance Show Const where
606 show (BI i) = show i ++ "L"
609 show (Str s) = show s
611 show BIType = "Integer"
612 show FlType = "Float"
614 show StrType = "String"
616 show VoidType = "Void"
618showEnv env t = showEnv' env t False
619showEnvDbg env t = showEnv' env t True
621prettyEnv env t = prettyEnv' env t False
623 prettyEnv' env t dbg = prettySe 10 env t dbg
625 bracket outer inner p
626 | inner > outer = lparen <> p <> rparen
629 prettySe p env (P nt n t) debug =
632 lbrack <+> pretty nt <+> colon <+> prettySe 10 env t debug <+> rbrack
635 prettySe p env (V i) debug
638 text . show . fst $ env!!i
640 lbrack <+> text (show i) <+> rbrack
641 | otherwise = text "unbound" <+> text (show i) <+> text "!"
642 prettySe p env (Bind n b@(Pi t) sc) debug
643 | noOccurrence n sc && not debug =
644 bracket p 2 $ prettySb env n b debug <> prettySe 10 ((n, b):env) sc debug
645 prettySe p env (Bind n b sc) debug =
646 bracket p 2 $ prettySb env n b debug <> prettySe 10 ((n, b):env) sc debug
647 prettySe p env (App f a) debug =
648 bracket p 1 $ prettySe 1 env f debug <+> prettySe 0 env a debug
649 prettySe p env (Constant c) debug = pretty c
650 prettySe p env Erased debug = text "[_]"
651 prettySe p env (Set i) debug = text "Set" <+> (text . show $ i)
653 prettySb env n (Lam t) = prettyB env "λ" "=>" n t
654 prettySb env n (Hole t) = prettyB env "?defer" "." n t
655 prettySb env n (Pi t) = prettyB env "(" ") ->" n t
656 prettySb env n (PVar t) = prettyB env "pat" "." n t
657 prettySb env n (PVTy t) = prettyB env "pty" "." n t
658 prettySb env n (Let t v) = prettyBv env "let" "in" n t v
659 prettySb env n (Guess t v) = prettyBv env "??" "in" n t v
661 prettyB env op sc n t debug =
662 text op <> pretty n <+> colon <+> prettySe 10 env t debug <> text sc
664 prettyBv env op sc n t v debug =
665 text op <> pretty n <+> colon <+> prettySe 10 env t debug <+> text "=" <+>
666 prettySe 10 env v debug <> text sc
669showEnv' env t dbg = se 10 env t where
670 se p env (P nt n t) = show n
671 ++ if dbg then "{" ++ show nt ++ " : " ++ se 10 env t ++ "}" else ""
672 se p env (V i) | i < length env = (show $ fst $ env!!i) ++
673 if dbg then "{" ++ show i ++ "}" else ""
674 | otherwise = "!!V " ++ show i ++ "!!"
675 se p env (Bind n b@(Pi t) sc)
676 | noOccurrence n sc && not dbg = bracket p 2 $ se 1 env t ++ " -> " ++ se 10 ((n,b):env) sc
677 se p env (Bind n b sc) = bracket p 2 $ sb env n b ++ se 10 ((n,b):env) sc
678 se p env (App f a) = bracket p 1 $ se 1 env f ++ " " ++ se 0 env a
679 se p env (Constant c) = show c
680 se p env Erased = "[__]"
681 se p env (Set i) = "Set " ++ show i
683 sb env n (Lam t) = showb env "\\ " " => " n t
684 sb env n (Hole t) = showb env "? " ". " n t
685 sb env n (GHole t) = showb env "?defer " ". " n t
686 sb env n (Pi t) = showb env "(" ") -> " n t
687 sb env n (PVar t) = showb env "pat " ". " n t
688 sb env n (PVTy t) = showb env "pty " ". " n t
689 sb env n (Let t v) = showbv env "let " " in " n t v
690 sb env n (Guess t v) = showbv env "?? " " in " n t v
692 showb env op sc n t = op ++ show n ++ " : " ++ se 10 env t ++ sc
693 showbv env op sc n t v = op ++ show n ++ " : " ++ se 10 env t ++ " = " ++
696 bracket outer inner str | inner > outer = "(" ++ str ++ ")"
699-- Check whether a term has any holes in it - impure if so
701pureTerm :: TT n -> Bool
702pureTerm (App f a) = pureTerm f && pureTerm a
703pureTerm (Bind n b sc) = pureBinder b && pureTerm sc where
704 pureBinder (Hole _) = False
705 pureBinder (Guess _ _) = False
706 pureBinder (Let t v) = pureTerm t && pureTerm v
707 pureBinder t = pureTerm (binderTy t)
710-- weaken a term by adding i to each de Bruijn index (i.e. lift it over i bindings)
712weakenTm :: Int -> TT n -> TT n
713weakenTm i t = wk i 0 t
714 where wk i min (V x) | x >= min = V (i + x)
715 wk i m (App f a) = App (wk i m f) (wk i m a)
716 wk i m (Bind x b sc) = Bind x (wkb i m b) (wk i (m + 1) sc)
718 wkb i m t = fmap (wk i m) t
720-- weaken an environment so that all the de Bruijn indices are correct according
721-- to the latest bound variable
723weakenEnv :: EnvTT n -> EnvTT n
724weakenEnv env = wk (length env - 1) env
726 wk i ((n, b) : bs) = (n, weakenTmB i b) : wk (i - 1) bs
727 weakenTmB i (Let t v) = Let (weakenTm i t) (weakenTm i v)
728 weakenTmB i (Guess t v) = Guess (weakenTm i t) (weakenTm i v)
729 weakenTmB i t = t { binderTy = weakenTm i (binderTy t) }
731weakenTmEnv :: Int -> EnvTT n -> EnvTT n
732weakenTmEnv i = map (\ (n, b) -> (n, fmap (weakenTm i) b))
734orderPats :: Term -> Term
735orderPats tm = op [] tm
737 op ps (Bind n (PVar t) sc) = op ((n, t) : ps) sc
738 op ps sc = bindAll (map (\ (n, t) -> (n, PVar t)) (sortP ps)) sc
740 sortP ps = pick [] (reverse ps)
742 namesIn (P _ n _) = [n]
743 namesIn (Bind n b t) = nub $ nb b ++ (namesIn t \\ [n])
744 where nb (Let t v) = nub (namesIn t) ++ nub (namesIn v)
745 nb (Guess t v) = nub (namesIn t) ++ nub (namesIn v)
746 nb t = namesIn (binderTy t)
747 namesIn (App f a) = nub (namesIn f ++ namesIn a)
750 pick acc [] = reverse acc
751 pick acc ((n, t) : ps) = pick (insert n t acc) ps
753 insert n t [] = [(n, t)]
754 insert n t ((n',t') : ps)
755 | n `elem` (namesIn t' ++ concatMap namesIn (map snd ps))
756 = (n', t') : insert n t ps
757 | otherwise = (n,t):(n',t'):ps
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list