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
420class TermSize a where
423instance TermSize a => TermSize [a] where
425 termsize (x : xs) = termsize x + termsize xs
427instance TermSize (TT a) where
428 termsize (P _ _ _) = 1
430 termsize (Bind n (Let t v) sc) = termsize v + termsize sc
431 termsize (App f a) = termsize f + termsize a
434instance Sized a => Sized (TT a) where
435 size (P name n trm) = 1 + size name + size n + size trm
437 size (Bind nm binder bdy) = 1 + size nm + size binder + size bdy
438 size (App l r) = 1 + size l + size r
439 size (Constant c) = size c
441 size (Set u) = 1 + size u
443instance Pretty a => Pretty (TT a) where
444 pretty _ = text "test"
446type EnvTT n = [(n, Binder (TT n))]
448data Datatype n = Data { d_typename :: n,
451 d_cons :: [(n, TT n)] }
452 deriving (Show, Functor, Eq)
454instance Eq n => Eq (TT n) where
455 (==) (P xt x _) (P yt y _) = xt == yt && x == y
456 (==) (V x) (V y) = x == y
457 (==) (Bind _ xb xs) (Bind _ yb ys) = xb == yb && xs == ys
458 (==) (App fx ax) (App fy ay) = fx == fy && ax == ay
459 (==) (Set _) (Set _) = True -- deal with constraints later
460 (==) (Constant x) (Constant y) = x == y
465-- A few handy operations on well typed terms:
467isInjective :: TT n -> Bool
468isInjective (P (DCon _ _) _ _) = True
469isInjective (P (TCon _ _) _ _) = True
470isInjective (Constant _) = True
471isInjective (Set x) = True
472isInjective (Bind _ (Pi _) sc) = True
473isInjective (App f a) = isInjective f
476-- Count the number of instances of a de Bruijn index in a term
477vinstances :: Int -> TT n -> Int
478vinstances i (V x) | i == x = 1
479vinstances i (App f a) = vinstances i f + vinstances i a
480vinstances i (Bind x b sc) = instancesB b + vinstances (i + 1) sc
481 where instancesB (Let t v) = vinstances i v
485instantiate :: TT n -> TT n -> TT n
486instantiate e = subst 0 where
487 subst i (V x) | i == x = e
488 subst i (Bind x b sc) = Bind x (fmap (subst i) b) (subst (i+1) sc)
489 subst i (App f a) = App (subst i f) (subst i a)
492pToV :: Eq n => n -> TT n -> TT n
494pToV' n i (P _ x _) | n == x = V i
495pToV' n i (Bind x b sc)
496 | n == x = Bind x (fmap (pToV' n i) b) sc
497 | otherwise = Bind x (fmap (pToV' n i) b) (pToV' n (i+1) sc)
498pToV' n i (App f a) = App (pToV' n i f) (pToV' n i a)
501-- Convert several names. First in the list comes out as V 0
502pToVs :: Eq n => [n] -> TT n -> TT n
503pToVs ns tm = pToVs' ns tm 0 where
505 pToVs' (n:ns) tm i = pToV' n i (pToVs' ns tm (i+1))
509 vToP' env (V i) = let (n, b) = (env !! i) in
510 P Bound n (binderTy b)
511 vToP' env (Bind n b sc) = let b' = fmap (vToP' env) b in
512 Bind n b' (vToP' ((n, b'):env) sc)
513 vToP' env (App f a) = App (vToP' env f) (vToP' env a)
516finalise :: Eq n => TT n -> TT n
517finalise (Bind x b sc) = Bind x (fmap finalise b) (pToV x (finalise sc))
518finalise (App f a) = App (finalise f) (finalise a)
521subst :: Eq n => n -> TT n -> TT n -> TT n
522subst n v tm = instantiate v (pToV n tm)
524substNames :: Eq n => [(n, TT n)] -> TT n -> TT n
526substNames ((n, tm) : xs) t = subst n tm (substNames xs t)
528-- Returns true if V 0 and bound name n do not occur in the term
530noOccurrence :: Eq n => n -> TT n -> Bool
531noOccurrence n t = no' 0 t
533 no' i (V x) = not (i == x)
534 no' i (P Bound x _) = not (n == x)
535 no' i (Bind n b sc) = noB' i b && no' (i+1) sc
536 where noB' i (Let t v) = no' i t && no' i v
537 noB' i (Guess t v) = no' i t && no' i v
538 noB' i b = no' i (binderTy b)
539 no' i (App f a) = no' i f && no' i a
542-- Returns all names used free in the term
544freeNames :: Eq n => TT n -> [n]
545freeNames (P _ n _) = [n]
546freeNames (Bind n (Let t v) sc) = nub $ freeNames v ++ (freeNames sc \\ [n])
548freeNames (Bind n b sc) = nub $ freeNames (binderTy b) ++ (freeNames sc \\ [n])
549freeNames (App f a) = nub $ freeNames f ++ freeNames a
552-- Return the arity of a (normalised) type
555arity (Bind n (Pi t) sc) = 1 + arity sc
558-- deconstruct an application; returns the function and a list of arguments
560unApply :: TT n -> (TT n, [TT n])
561unApply t = ua [] t where
562 ua args (App f a) = ua (a:args) f
563 ua args t = (t, args)
565mkApp :: TT n -> [TT n] -> TT n
567mkApp f (a:as) = mkApp (App f a) as
569forget :: TT Name -> Raw
572 fe env (P _ n _) = Var n
573 fe env (V i) = Var (env !! i)
574 fe env (Bind n b sc) = RBind n (fmap (fe env) b)
576 fe env (App f a) = RApp (fe env f) (fe env a)
579 fe env (Set i) = RSet
580 fe env Erased = RConstant Forgot
582bindAll :: [(n, Binder (TT n))] -> TT n -> TT n
584bindAll ((n, b) : bs) t = Bind n b (bindAll bs t)
586bindTyArgs :: (TT n -> Binder (TT n)) -> [(n, TT n)] -> TT n -> TT n
587bindTyArgs b xs = bindAll (map (\ (n, ty) -> (n, b ty)) xs)
589getArgTys :: TT n -> [(n, TT n)]
590getArgTys (Bind n (Pi t) sc) = (n, t) : getArgTys sc
593getRetTy :: TT n -> TT n
594getRetTy (Bind n (PVar _) sc) = getRetTy sc
595getRetTy (Bind n (PVTy _) sc) = getRetTy sc
596getRetTy (Bind n (Pi _) sc) = getRetTy sc
599uniqueName :: Name -> [Name] -> Name
600uniqueName n hs | n `elem` hs = uniqueName (nextName n) hs
603nextName (NS x s) = NS (nextName x) s
604nextName (MN i n) = MN (i+1) n
605nextName (UN x) = let (num', nm') = span isDigit (reverse x)
607 num = readN (reverse num') in
608 UN (nm ++ show (num+1))
618-- an environment with de Bruijn indices 'normalised' so that they all refer to
621newtype WkEnvTT n = Wk (EnvTT n)
622type WkEnv = WkEnvTT Name
624instance (Eq n, Show n) => Show (TT n) where
625 show t = showEnv [] t
627instance Show Const where
629 show (BI i) = show i ++ "L"
632 show (Str s) = show s
634 show BIType = "Integer"
635 show FlType = "Float"
637 show StrType = "String"
639 show VoidType = "Void"
641showEnv env t = showEnv' env t False
642showEnvDbg env t = showEnv' env t True
644prettyEnv env t = prettyEnv' env t False
646 prettyEnv' env t dbg = prettySe 10 env t dbg
648 bracket outer inner p
649 | inner > outer = lparen <> p <> rparen
652 prettySe p env (P nt n t) debug =
655 lbrack <+> pretty nt <+> colon <+> prettySe 10 env t debug <+> rbrack
658 prettySe p env (V i) debug
661 text . show . fst $ env!!i
663 lbrack <+> text (show i) <+> rbrack
664 | otherwise = text "unbound" <+> text (show i) <+> text "!"
665 prettySe p env (Bind n b@(Pi t) sc) debug
666 | noOccurrence n sc && not debug =
667 bracket p 2 $ prettySb env n b debug <> prettySe 10 ((n, b):env) sc debug
668 prettySe p env (Bind n b sc) debug =
669 bracket p 2 $ prettySb env n b debug <> prettySe 10 ((n, b):env) sc debug
670 prettySe p env (App f a) debug =
671 bracket p 1 $ prettySe 1 env f debug <+> prettySe 0 env a debug
672 prettySe p env (Constant c) debug = pretty c
673 prettySe p env Erased debug = text "[_]"
674 prettySe p env (Set i) debug = text "Set" <+> (text . show $ i)
676 prettySb env n (Lam t) = prettyB env "λ" "=>" n t
677 prettySb env n (Hole t) = prettyB env "?defer" "." n t
678 prettySb env n (Pi t) = prettyB env "(" ") ->" n t
679 prettySb env n (PVar t) = prettyB env "pat" "." n t
680 prettySb env n (PVTy t) = prettyB env "pty" "." n t
681 prettySb env n (Let t v) = prettyBv env "let" "in" n t v
682 prettySb env n (Guess t v) = prettyBv env "??" "in" n t v
684 prettyB env op sc n t debug =
685 text op <> pretty n <+> colon <+> prettySe 10 env t debug <> text sc
687 prettyBv env op sc n t v debug =
688 text op <> pretty n <+> colon <+> prettySe 10 env t debug <+> text "=" <+>
689 prettySe 10 env v debug <> text sc
692showEnv' env t dbg = se 10 env t where
693 se p env (P nt n t) = show n
694 ++ if dbg then "{" ++ show nt ++ " : " ++ se 10 env t ++ "}" else ""
695 se p env (V i) | i < length env = (show $ fst $ env!!i) ++
696 if dbg then "{" ++ show i ++ "}" else ""
697 | otherwise = "!!V " ++ show i ++ "!!"
698 se p env (Bind n b@(Pi t) sc)
699 | noOccurrence n sc && not dbg = bracket p 2 $ se 1 env t ++ " -> " ++ se 10 ((n,b):env) sc
700 se p env (Bind n b sc) = bracket p 2 $ sb env n b ++ se 10 ((n,b):env) sc
701 se p env (App f a) = bracket p 1 $ se 1 env f ++ " " ++ se 0 env a
702 se p env (Constant c) = show c
703 se p env Erased = "[__]"
704 se p env (Set i) = "Set " ++ show i
706 sb env n (Lam t) = showb env "\\ " " => " n t
707 sb env n (Hole t) = showb env "? " ". " n t
708 sb env n (GHole t) = showb env "?defer " ". " n t
709 sb env n (Pi t) = showb env "(" ") -> " n t
710 sb env n (PVar t) = showb env "pat " ". " n t
711 sb env n (PVTy t) = showb env "pty " ". " n t
712 sb env n (Let t v) = showbv env "let " " in " n t v
713 sb env n (Guess t v) = showbv env "?? " " in " n t v
715 showb env op sc n t = op ++ show n ++ " : " ++ se 10 env t ++ sc
716 showbv env op sc n t v = op ++ show n ++ " : " ++ se 10 env t ++ " = " ++
719 bracket outer inner str | inner > outer = "(" ++ str ++ ")"
722-- Check whether a term has any holes in it - impure if so
724pureTerm :: TT n -> Bool
725pureTerm (App f a) = pureTerm f && pureTerm a
726pureTerm (Bind n b sc) = pureBinder b && pureTerm sc where
727 pureBinder (Hole _) = False
728 pureBinder (Guess _ _) = False
729 pureBinder (Let t v) = pureTerm t && pureTerm v
730 pureBinder t = pureTerm (binderTy t)
733-- weaken a term by adding i to each de Bruijn index (i.e. lift it over i bindings)
735weakenTm :: Int -> TT n -> TT n
736weakenTm i t = wk i 0 t
737 where wk i min (V x) | x >= min = V (i + x)
738 wk i m (App f a) = App (wk i m f) (wk i m a)
739 wk i m (Bind x b sc) = Bind x (wkb i m b) (wk i (m + 1) sc)
741 wkb i m t = fmap (wk i m) t
743-- weaken an environment so that all the de Bruijn indices are correct according
744-- to the latest bound variable
746weakenEnv :: EnvTT n -> EnvTT n
747weakenEnv env = wk (length env - 1) env
749 wk i ((n, b) : bs) = (n, weakenTmB i b) : wk (i - 1) bs
750 weakenTmB i (Let t v) = Let (weakenTm i t) (weakenTm i v)
751 weakenTmB i (Guess t v) = Guess (weakenTm i t) (weakenTm i v)
752 weakenTmB i t = t { binderTy = weakenTm i (binderTy t) }
754weakenTmEnv :: Int -> EnvTT n -> EnvTT n
755weakenTmEnv i = map (\ (n, b) -> (n, fmap (weakenTm i) b))
757orderPats :: Term -> Term
758orderPats tm = op [] tm
760 op ps (Bind n (PVar t) sc) = op ((n, t) : ps) sc
761 op ps sc = bindAll (map (\ (n, t) -> (n, PVar t)) (sortP ps)) sc
763 sortP ps = pick [] (reverse ps)
765 namesIn (P _ n _) = [n]
766 namesIn (Bind n b t) = nub $ nb b ++ (namesIn t \\ [n])
767 where nb (Let t v) = nub (namesIn t) ++ nub (namesIn v)
768 nb (Guess t v) = nub (namesIn t) ++ nub (namesIn v)
769 nb t = namesIn (binderTy t)
770 namesIn (App f a) = nub (namesIn f ++ namesIn a)
773 pick acc [] = reverse acc
774 pick acc ((n, t) : ps) = pick (insert n t acc) ps
776 insert n t [] = [(n, t)]
777 insert n t ((n',t') : ps)
778 | n `elem` (namesIn t' ++ concatMap namesIn (map snd ps))
779 = (n', t') : insert n t ps
780 | 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