1{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances, DeriveFunctor,
2 TypeSynonymInstances, PatternGuards #-}
4module Idris.AbsSyntaxTree where
8import Core.Elaborate hiding (Tactic(..))
11import IRTS.CodegenCommon
13import Util.DynamicLinker
19import System.Console.Haskeline
22import Control.Monad.Trans.State.Strict
23import Control.Monad.Trans.Error
28import Data.Word (Word)
32data IOption = IOption { opt_logLevel :: Int,
34 opt_typeintype :: Bool,
36 opt_showimp :: Bool, -- ^^ show implicits
37 opt_errContext :: Bool,
41 opt_codegen :: Codegen,
42 opt_outputTy :: OutputType,
43 opt_ibcsubdir :: FilePath,
44 opt_importdirs :: [FilePath],
48 opt_cmdline :: [Opt] -- remember whole command line
52defaultOpts = IOption { opt_logLevel = 0
53 , opt_typecase = False
54 , opt_typeintype = False
57 , opt_errContext = False
62 , opt_outputTy = Executable
71data LanguageExt = TypeProviders | ErrorReflection deriving (Show, Eq, Read, Ord)
73-- | The output mode in use
74data OutputMode = RawOutput | IdeSlave Integer deriving Show
76-- TODO: Add 'module data' to IState, which can be saved out and reloaded quickly (i.e
77-- without typechecking).
78-- This will include all the functions and data declarations, plus fixity declarations
81-- | The global state used in the Idris monad
83 tt_ctxt :: Context, -- ^ All the currently defined names and their terms
84 idris_constraints :: [(UConstraint, FC)],
85 -- ^ A list of universe constraints and their corresponding source locations
86 idris_infixes :: [FixDecl], -- ^ Currently defined infix operators
87 idris_implicits :: Ctxt [PArg],
88 idris_statics :: Ctxt [Bool],
89 idris_classes :: Ctxt ClassInfo,
90 idris_dsls :: Ctxt DSL,
91 idris_optimisation :: Ctxt OptInfo,
92 idris_datatypes :: Ctxt TypeInfo,
93 idris_patdefs :: Ctxt ([([Name], Term, Term)], [PTerm]), -- not exported
94 -- ^ list of lhs/rhs, and a list of missing clauses
95 idris_flags :: Ctxt [FnOpt],
96 idris_callgraph :: Ctxt CGInfo, -- name, args used in each pos
97 idris_calledgraph :: Ctxt [Name],
98 idris_docstrings :: Ctxt String,
99 idris_totcheck :: [(FC, Name)],
101 idris_options :: IOption,
103 idris_linename :: [((FilePath, Int), (Name, Int))],
104 -- ^ internal name for function defined on that line,
105 -- number of 'with' arguments
106 idris_metavars :: [Name], -- ^ The currently defined but not proven metavariables
107 idris_coercions :: [Name],
108 idris_transforms :: [(Term, Term)],
109 syntax_rules :: [Syntax],
110 syntax_keywords :: [String],
111 imported :: [FilePath], -- ^ The imported modules
112 idris_scprims :: [(Name, (Int, PrimFn))],
113 idris_objs :: [(Codegen, FilePath)],
114 idris_libs :: [(Codegen, String)],
115 idris_cgflags :: [(Codegen, String)],
116 idris_hdrs :: [(Codegen, String)],
117 proof_list :: [(Name, [String])],
118 errLine :: Maybe Int,
119 lastParse :: Maybe Name,
120 indent_stack :: [Int],
121 brace_stack :: [Maybe Int],
122 hide_list :: [(Name, Maybe Accessibility)],
123 default_access :: Accessibility,
124 default_total :: Bool,
125 ibc_write :: [IBCWrite],
126 compiled_so :: Maybe String,
127 idris_dynamic_libs :: [DynamicLib],
128 idris_language_extensions :: [LanguageExt],
129 idris_outputmode :: OutputMode,
130 idris_colourRepl :: Bool,
131 idris_colourTheme :: ColourTheme
134data SizeChange = Smaller | Same | Bigger | Unknown
137deriving instance Binary SizeChange
140type SCGEntry = (Name, [Maybe (Int, SizeChange)])
142data CGInfo = CGInfo { argsdef :: [Name],
143 calls :: [(Name, [[Name]])],
149deriving instance Binary CGInfo
152primDefs = [UN "unsafePerformPrimIO",
153 UN "mkLazyForeignPrim",
157-- information that needs writing for the current module's .ibc file
158data IBCWrite = IBCFix FixDecl
162 | IBCInstance Bool Name Name
169 | IBCObj Codegen FilePath
170 | IBCLib Codegen String
171 | IBCCGFlag Codegen String
173 | IBCHeader Codegen String
174 | IBCAccess Name Accessibility
175 | IBCTotal Name Totality
176 | IBCFlags Name [FnOpt]
177 | IBCTrans (Term, Term)
181 | IBCDef Name -- i.e. main context
182 | IBCLineName FilePath Int Name Int
185idrisInit = IState initContext [] [] emptyContext emptyContext emptyContext
186 emptyContext emptyContext emptyContext emptyContext
187 emptyContext emptyContext emptyContext emptyContext
188 [] "" defaultOpts 6 [] [] [] [] [] [] [] [] [] [] [] []
189 [] Nothing Nothing [] [] [] Hidden False [] Nothing [] [] RawOutput
192-- | The monad for the main REPL - reading and processing files and updating
193-- global state (hence the IO inner monad).
194--type Idris = WriterT [Either String (IO ())] (State IState a))
195type Idris = StateT IState (ErrorT Err IO)
197-- Commands in the REPL
216 | ChangeDirectory FilePath
219 | Compile Codegen String
224 | AddProof (Maybe Name)
237 | DynamicLink FilePath
242 | CaseSplit Name PTerm
246 | SetColour ColourType IdrisColour
250data Opt = Filename String
284 | OutputTy OutputType
285 | Extension LanguageExt
286 | InterpretScript String
287 | TargetTriple String
292-- Parsed declarations
294data Fixity = Infixl { prec :: Int }
295 | Infixr { prec :: Int }
296 | InfixN { prec :: Int }
297 | PrefixN { prec :: Int }
300deriving instance Binary Fixity
303instance Show Fixity where
304 show (Infixl i) = "infixl " ++ show i
305 show (Infixr i) = "infixr " ++ show i
306 show (InfixN i) = "infix " ++ show i
307 show (PrefixN i) = "prefix " ++ show i
309data FixDecl = Fix Fixity String
312instance Show FixDecl where
313 show (Fix f s) = show f ++ " " ++ s
316deriving instance Binary FixDecl
319instance Ord FixDecl where
320 compare (Fix x _) (Fix y _) = compare (prec x) (prec y)
323data Static = Static | Dynamic
326deriving instance Binary Static
329-- Mark bindings with their explicitness, and laziness
330data Plicity = Imp { plazy :: Bool,
333 | Exp { plazy :: Bool,
336 | Constraint { plazy :: Bool,
339 | TacImp { plazy :: Bool,
346deriving instance Binary Plicity
349impl = Imp False Dynamic ""
350expl = Exp False Dynamic ""
351constraint = Constraint False Dynamic ""
352tacimpl t = TacImp False Dynamic t ""
354data FnOpt = Inlinable -- always evaluate when simplifying
355 | TotalFn | PartialFn
356 | Coinductive | AssertTotal
357 | Dictionary -- type class dictionary, eval only when
358 -- a function argument, and further evaluation resutls
359 | Implicit -- implicit coercion
360 | CExport String -- export, with a C name
361 | Reflection -- a reflecting function, compile-time only
362 | Specialise [(Name, Maybe Int)] -- specialise it, freeze these names
365deriving instance Binary FnOpt
370inlinable :: FnOpts -> Bool
371inlinable = elem Inlinable
373dictionary :: FnOpts -> Bool
374dictionary = elem Dictionary
376-- | Top-level declarations such as compiler directives, definitions,
377-- datatypes and typeclasses.
379 = PFix FC Fixity [String] -- ^ Fixity declaration
380 | PTy String SyntaxInfo FC FnOpts Name t -- ^ Type declaration
381 | PPostulate String SyntaxInfo FC FnOpts Name t -- ^ Postulate
382 | PClauses FC FnOpts Name [PClause' t] -- ^ Pattern clause
383 | PCAF FC Name t -- ^ Top level constant
384 | PData String SyntaxInfo FC Bool (PData' t) -- ^ Data declaration. The Bool argument is True for codata.
385 | PParams FC [(Name, t)] [PDecl' t] -- ^ Params block
386 | PNamespace String [PDecl' t] -- ^ New namespace
387 | PRecord String SyntaxInfo FC Name t String Name t -- ^ Record declaration
388 | PClass String SyntaxInfo FC
391 [(Name, t)] -- parameters
392 [PDecl' t] -- declarations
393 -- ^ Type class: arguments are documentation, syntax info, source location, constraints,
394 -- class name, parameters, method declarations
395 | PInstance SyntaxInfo FC [t] -- constraints
398 t -- full instance type
399 (Maybe Name) -- explicit name
401 -- ^ Instance declaration: arguments are syntax info, source location, constraints,
402 -- class name, parameters, full instance type, optional explicit name, and definitions
403 | PDSL Name (DSL' t) -- ^ DSL declaration
404 | PSyntax FC Syntax -- ^ Syntax definition
405 | PMutual FC [PDecl' t] -- ^ Mutual block
406 | PDirective (Idris ()) -- ^ Compiler directive. The parser inserts the corresponding action in the Idris monad.
407 | PProvider SyntaxInfo FC Name t t -- ^ Type provider. The first t is the type, the second is the term
408 | PTransform FC Bool t t -- ^ Source-to-source transformation rule. If
409 -- bool is True, lhs and rhs must be convertible
412deriving instance Binary PDecl'
415-- | One clause of a top-level definition. Term arguments to constructors are:
417-- 1. The whole application (missing for PClauseR and PWithR because they're within a "with" clause)
419-- 2. The list of patterns
421-- 3. The right-hand side
423-- 4. The where block (PDecl' t)
424data PClause' t = PClause FC Name t [t] t [PDecl' t] -- ^ A normal top-level definition.
425 | PWith FC Name t [t] t [PDecl' t]
426 | PClauseR FC [t] t [PDecl' t]
427 | PWithR FC [t] t [PDecl' t]
430deriving instance Binary PClause'
434data PData' t = PDatadecl { d_name :: Name, -- ^ The name of the datatype
435 d_tcon :: t, -- ^ Type constructor
436 d_cons :: [(String, Name, t, FC)] -- ^ Constructors
438 -- ^ Data declaration
439 | PLaterdecl { d_name :: Name, d_tcon :: t }
440 -- ^ "Placeholder" for data whose constructors are defined later
443deriving instance Binary PData'
446-- Handy to get a free function for applying PTerm -> PTerm functions
447-- across a program, by deriving Functor
449type PDecl = PDecl' PTerm
450type PData = PData' PTerm
451type PClause = PClause' PTerm
453-- get all the names declared in a decl
455declared :: PDecl -> [Name]
456declared (PFix _ _ _) = []
457declared (PTy _ _ _ _ n t) = [n]
458declared (PPostulate _ _ _ _ n t) = [n]
459declared (PClauses _ _ n _) = [] -- not a declaration
460declared (PCAF _ n _) = [n]
461declared (PData _ _ _ _ (PDatadecl n _ ts)) = n : map fstt ts
462 where fstt (_, a, _, _) = a
463declared (PData _ _ _ _ (PLaterdecl n _)) = [n]
464declared (PParams _ _ ds) = concatMap declared ds
465declared (PNamespace _ ds) = concatMap declared ds
466declared (PRecord _ _ _ n _ _ c _) = [n, c]
467declared (PClass _ _ _ _ n _ ms) = n : concatMap declared ms
468declared (PInstance _ _ _ _ _ _ _ _) = []
469declared (PDSL n _) = [n]
470declared (PSyntax _ _) = []
471declared (PMutual _ ds) = concatMap declared ds
472declared (PDirective _) = []
474-- get the names declared, not counting nested parameter blocks
475tldeclared :: PDecl -> [Name]
476tldeclared (PFix _ _ _) = []
477tldeclared (PTy _ _ _ _ n t) = [n]
478tldeclared (PPostulate _ _ _ _ n t) = [n]
479tldeclared (PClauses _ _ n _) = [] -- not a declaration
480tldeclared (PRecord _ _ _ n _ _ c _) = [n, c]
481tldeclared (PData _ _ _ _ (PDatadecl n _ ts)) = n : map fstt ts
482 where fstt (_, a, _, _) = a
483tldeclared (PParams _ _ ds) = []
484tldeclared (PMutual _ ds) = concatMap tldeclared ds
485tldeclared (PNamespace _ ds) = concatMap tldeclared ds
486tldeclared (PClass _ _ _ _ n _ ms) = concatMap tldeclared ms
487tldeclared (PInstance _ _ _ _ _ _ _ _) = []
490defined :: PDecl -> [Name]
491defined (PFix _ _ _) = []
492defined (PTy _ _ _ _ n t) = []
493defined (PPostulate _ _ _ _ n t) = []
494defined (PClauses _ _ n _) = [n] -- not a declaration
495defined (PCAF _ n _) = [n]
496defined (PData _ _ _ _ (PDatadecl n _ ts)) = n : map fstt ts
497 where fstt (_, a, _, _) = a
498defined (PData _ _ _ _ (PLaterdecl n _)) = []
499defined (PParams _ _ ds) = concatMap defined ds
500defined (PNamespace _ ds) = concatMap defined ds
501defined (PRecord _ _ _ n _ _ c _) = [n, c]
502defined (PClass _ _ _ _ n _ ms) = n : concatMap defined ms
503defined (PInstance _ _ _ _ _ _ _ _) = []
504defined (PDSL n _) = [n]
505defined (PSyntax _ _) = []
506defined (PMutual _ ds) = concatMap defined ds
507defined (PDirective _) = []
510updateN :: [(Name, Name)] -> Name -> Name
511updateN ns n | Just n' <- lookup n ns = n'
514updateNs :: [(Name, Name)] -> PTerm -> PTerm
516updateNs ns t = mapPT updateRef t
517 where updateRef (PRef fc f) = PRef fc (updateN ns f)
520-- updateDNs :: [(Name, Name)] -> PDecl -> PDecl
522-- updateDNs ns (PTy s f n t) | Just n' <- lookup n ns = PTy s f n' t
523-- updateDNs ns (PClauses f n c) | Just n' <- lookup n ns = PClauses f n' (map updateCNs c)
524-- where updateCNs ns (PClause n l ts r ds)
525-- = PClause (updateN ns n) (fmap (updateNs ns) l)
526-- (map (fmap (updateNs ns)) ts)
527-- (fmap (updateNs ns) r)
528-- (map (updateDNs ns) ds)
531-- | High level language terms
532data PTerm = PQuote Raw
534 | PInferRef FC Name -- ^ A name to be defined later
536 | PLam Name PTerm PTerm
537 | PPi Plicity Name PTerm PTerm
538 | PLet Name PTerm PTerm PTerm
539 | PTyped PTerm PTerm -- ^ Term with explicit type
540 | PApp FC PTerm [PArg]
541 | PAppBind FC PTerm [PArg] -- ^ implicitly bound application
542 | PMatchApp FC Name -- ^ Make an application by type matching
543 | PCase FC PTerm [(PTerm, PTerm)]
549 | PRewrite FC PTerm PTerm (Maybe PTerm)
550 | PPair FC PTerm PTerm
551 | PDPair FC PTerm PTerm PTerm
552 | PAlternative Bool [PTerm] -- True if only one may work
553 | PHidden PTerm -- ^ Irrelevant or hidden pattern
555 | PGoal FC PTerm Name PTerm
562 | PProof [PTactic] -- ^ Proof script
563 | PTactics [PTactic] -- ^ As PProof, but no auto solving
564 | PElabError Err -- ^ Error to report on elaboration
565 | PImpossible -- ^ Special case for declaring when an LHS can't typecheck
566 | PCoerced PTerm -- ^ To mark a coerced argument, so as not to coerce twice
567 | PUnifyLog PTerm -- ^ dump a trace of unifications when building term
568 | PNoImplicits PTerm -- ^ never run implicit converions on the term
573deriving instance Binary PTerm
576mapPT :: (PTerm -> PTerm) -> PTerm -> PTerm
577mapPT f t = f (mpt t) where
578 mpt (PLam n t s) = PLam n (mapPT f t) (mapPT f s)
579 mpt (PPi p n t s) = PPi p n (mapPT f t) (mapPT f s)
580 mpt (PLet n ty v s) = PLet n (mapPT f ty) (mapPT f v) (mapPT f s)
581 mpt (PRewrite fc t s g) = PRewrite fc (mapPT f t) (mapPT f s)
583 mpt (PApp fc t as) = PApp fc (mapPT f t) (map (fmap (mapPT f)) as)
584 mpt (PAppBind fc t as) = PAppBind fc (mapPT f t) (map (fmap (mapPT f)) as)
585 mpt (PCase fc c os) = PCase fc (mapPT f c) (map (pmap (mapPT f)) os)
586 mpt (PEq fc l r) = PEq fc (mapPT f l) (mapPT f r)
587 mpt (PTyped l r) = PTyped (mapPT f l) (mapPT f r)
588 mpt (PPair fc l r) = PPair fc (mapPT f l) (mapPT f r)
589 mpt (PDPair fc l t r) = PDPair fc (mapPT f l) (mapPT f t) (mapPT f r)
590 mpt (PAlternative a as) = PAlternative a (map (mapPT f) as)
591 mpt (PHidden t) = PHidden (mapPT f t)
592 mpt (PDoBlock ds) = PDoBlock (map (fmap (mapPT f)) ds)
593 mpt (PProof ts) = PProof (map (fmap (mapPT f)) ts)
594 mpt (PTactics ts) = PTactics (map (fmap (mapPT f)) ts)
595 mpt (PUnifyLog tm) = PUnifyLog (mapPT f tm)
596 mpt (PNoImplicits tm) = PNoImplicits (mapPT f tm)
597 mpt (PGoal fc r n sc) = PGoal fc (mapPT f r) n (mapPT f sc)
601data PTactic' t = Intro [Name] | Intros | Focus Name
602 | Refine Name [Bool] | Rewrite t
605 | LetTac Name t | LetTacTy Name t t
606 | Exact t | Compute | Trivial
609 | ProofState | ProofTerm | Undo
610 | Try (PTactic' t) (PTactic' t)
611 | TSeq (PTactic' t) (PTactic' t)
612 | ApplyTactic t -- see Language.Reflection module
615 | GoalType String (PTactic' t)
617 deriving (Show, Eq, Functor)
619deriving instance Binary PTactic'
622instance Sized a => Sized (PTactic' a) where
623 size (Intro nms) = 1 + size nms
625 size (Focus nm) = 1 + size nm
626 size (Refine nm bs) = 1 + size nm + length bs
627 size (Rewrite t) = 1 + size t
628 size (LetTac nm t) = 1 + size nm + size t
629 size (Exact t) = 1 + size t
637 size (Try l r) = 1 + size l + size r
638 size (TSeq l r) = 1 + size l + size r
639 size (ApplyTactic t) = 1 + size t
640 size (Reflect t) = 1 + size t
641 size (Fill t) = 1 + size t
645type PTactic = PTactic' PTerm
647data PDo' t = DoExp FC t
652 deriving (Eq, Functor)
654deriving instance Binary PDo'
657instance Sized a => Sized (PDo' a) where
658 size (DoExp fc t) = 1 + size fc + size t
659 size (DoBind fc nm t) = 1 + size fc + size nm + size t
660 size (DoBindP fc l r) = 1 + size fc + size l + size r
661 size (DoLet fc nm l r) = 1 + size fc + size nm + size l + size r
662 size (DoLetP fc l r) = 1 + size fc + size l + size r
666-- The priority gives a hint as to elaboration order. Best to elaborate
667-- things early which will help give a more concrete type to other
668-- variables, e.g. a before (interpTy a).
670data PArg' t = PImp { priority :: Int,
671 machine_inf :: Bool, -- true if the machine inferred it
672 lazyarg :: Bool, pname :: Name, getTm :: t,
674 | PExp { priority :: Int,
675 lazyarg :: Bool, getTm :: t,
677 | PConstraint { priority :: Int,
678 lazyarg :: Bool, getTm :: t,
680 | PTacImplicit { priority :: Int,
681 lazyarg :: Bool, pname :: Name,
685 deriving (Show, Eq, Functor)
687instance Sized a => Sized (PArg' a) where
688 size (PImp p _ l nm trm _) = 1 + size nm + size trm
689 size (PExp p l trm _) = 1 + size trm
690 size (PConstraint p l trm _) = 1 + size trm
691 size (PTacImplicit p l nm scr trm _) = 1 + size nm + size scr + size trm
694deriving instance Binary PArg'
697pimp n t mach = PImp 1 mach True n t ""
698pexp t = PExp 1 False t ""
699pconst t = PConstraint 1 False t ""
700ptacimp n s t = PTacImplicit 0 True n s t ""
702type PArg = PArg' PTerm
706data ClassInfo = CI { instanceName :: Name,
707 class_methods :: [(Name, (FnOpts, PTerm))],
708 class_defaults :: [(Name, (Name, PDecl))], -- method name -> default impl
709 class_params :: [Name],
710 class_instances :: [Name] }
713deriving instance Binary ClassInfo
716data OptInfo = Optimise { collapsible :: Bool,
718 forceable :: [Int], -- argument positions
722deriving instance Binary OptInfo
726data TypeInfo = TI { con_names :: [Name],
731deriving instance Binary TypeInfo
734-- Syntactic sugar info
736data DSL' t = DSL { dsl_bind :: t,
741 index_first :: Maybe t,
742 index_next :: Maybe t,
743 dsl_lambda :: Maybe t,
746 deriving (Show, Functor)
748deriving instance Binary DSL'
753data SynContext = PatternSyntax | TermSyntax | AnySyntax
756deriving instance Binary SynContext
759data Syntax = Rule [SSymbol] PTerm SynContext
762deriving instance Binary Syntax
765data SSymbol = Keyword Name
772deriving instance Binary SSymbol
775initDSL = DSL (PRef f (UN ">>="))
776 (PRef f (UN "return"))
784 where f = fileFC "(builtin)"
786data Using = UImplicit Name PTerm
787 | UConstraint Name [Name]
790deriving instance Binary Using
793data SyntaxInfo = Syn { using :: [Using],
794 syn_params :: [(Name, PTerm)],
795 syn_namespace :: [String],
797 decoration :: Name -> Name,
799 implicitAllowed :: Bool,
803deriving instance Binary SyntaxInfo
806defaultSyntax = Syn [] [] [] [] id False False initDSL
808expandNS :: SyntaxInfo -> Name -> Name
809expandNS syn n@(NS _ _) = n
810expandNS syn n = case syn_namespace syn of
815--- Pretty printing declarations and terms
817instance Show PTerm where
818 show tm = showImp Nothing False False tm
820instance Pretty PTerm where
821 pretty = prettyImp False
823instance Show PDecl where
824 show d = showDeclImp False d
826instance Show PClause where
827 show c = showCImp True c
829instance Show PData where
830 show d = showDImp False d
832showDeclImp _ (PFix _ f ops) = show f ++ " " ++ showSep ", " ops
833showDeclImp t (PTy _ _ _ _ n ty) = show n ++ " : " ++ showImp Nothing t False ty
834showDeclImp t (PPostulate _ _ _ _ n ty) = show n ++ " : " ++ showImp Nothing t False ty
835showDeclImp _ (PClauses _ _ n c) = showSep "\n" (map show c)
836showDeclImp _ (PData _ _ _ _ d) = show d
837showDeclImp _ (PParams f ns ps) = "parameters " ++ show ns ++ "\n" ++
838 showSep "\n" (map show ps)
841showCImp :: Bool -> PClause -> String
842showCImp impl (PClause _ n l ws r w)
843 = showImp Nothing impl False l ++ showWs ws ++ " = " ++ showImp Nothing impl False r
844 ++ " where " ++ show w
847 showWs (x : xs) = " | " ++ showImp Nothing impl False x ++ showWs xs
848showCImp impl (PWith _ n l ws r w)
849 = showImp Nothing impl False l ++ showWs ws ++ " with " ++ showImp Nothing impl False r
850 ++ " { " ++ show w ++ " } "
853 showWs (x : xs) = " | " ++ showImp Nothing impl False x ++ showWs xs
856showDImp :: Bool -> PData -> String
857showDImp impl (PDatadecl n ty cons)
858 = "data " ++ show n ++ " : " ++ showImp Nothing impl False ty ++ " where\n\t"
860 (map (\ (_, n, t, _) -> show n ++ " : " ++ showImp Nothing impl False t) cons)
862getImps :: [PArg] -> [(Name, PTerm)]
864getImps (PImp _ _ _ n tm _ : xs) = (n, tm) : getImps xs
865getImps (_ : xs) = getImps xs
867getExps :: [PArg] -> [PTerm]
869getExps (PExp _ _ tm _ : xs) = tm : getExps xs
870getExps (_ : xs) = getExps xs
872getConsts :: [PArg] -> [PTerm]
874getConsts (PConstraint _ _ tm _ : xs) = tm : getConsts xs
875getConsts (_ : xs) = getConsts xs
877getAll :: [PArg] -> [PTerm]
880-- | Pretty-print a high-level Idris term
881prettyImp :: Bool -- ^^ whether to show implicits
882 -> PTerm -- ^^ the term to pretty-print
884prettyImp impl = prettySe 10
886 prettySe p (PQuote r) =
887 if size r > breakingSize then
888 text "![" $$ pretty r <> text "]"
890 text "![" <> pretty r <> text "]"
891 prettySe p (PPatvar fc n) = pretty n
892 prettySe p (PRef fc n) =
898 prettyBasic n@(UN _) = pretty n
899 prettyBasic (MN _ s) = text s
900 prettyBasic (NS n s) = (foldr (<>) empty (intersperse (text ".") (map text $ reverse s))) <> prettyBasic n
901 prettyBasic (SN sn) = text (show sn)
902 prettySe p (PLam n ty sc) =
904 if size sc > breakingSize then
905 text "λ" <> pretty n <+> text "=>" $+$ pretty sc
907 text "λ" <> pretty n <+> text "=>" <+> pretty sc
908 prettySe p (PLet n ty v sc) =
910 if size sc > breakingSize then
911 text "let" <+> pretty n <+> text "=" <+> prettySe 10 v <+> text "in" $+$
912 nest nestingSize (prettySe 10 sc)
914 text "let" <+> pretty n <+> text "=" <+> prettySe 10 v <+> text "in" <+>
916 prettySe p (PPi (Exp l s _) n ty sc)
917 | n `elem` allNamesIn sc || impl =
918 let open = if l then text "|" <> lparen else lparen in
920 if size sc > breakingSize then
921 open <> pretty n <+> colon <+> prettySe 10 ty <> rparen <+>
922 st <+> text "->" $+$ prettySe 10 sc
924 open <> pretty n <+> colon <+> prettySe 10 ty <> rparen <+>
925 st <+> text "->" <+> prettySe 10 sc
928 if size sc > breakingSize then
929 prettySe 0 ty <+> st <+> text "->" $+$ prettySe 10 sc
931 prettySe 0 ty <+> st <+> text "->" <+> prettySe 10 sc
935 Static -> text "[static]"
937 prettySe p (PPi (Imp l s _) n ty sc)
939 let open = if l then text "|" <> lbrace else lbrace in
941 if size sc > breakingSize then
942 open <> pretty n <+> colon <+> prettySe 10 ty <> rbrace <+>
943 st <+> text "->" <+> prettySe 10 sc
945 open <> pretty n <+> colon <+> prettySe 10 ty <> rbrace <+>
946 st <+> text "->" <+> prettySe 10 sc
947 | otherwise = prettySe 10 sc
951 Static -> text $ "[static]"
953 prettySe p (PPi (Constraint _ _ _) n ty sc) =
955 if size sc > breakingSize then
956 prettySe 10 ty <+> text "=>" <+> prettySe 10 sc
958 prettySe 10 ty <+> text "=>" $+$ prettySe 10 sc
959 prettySe p (PPi (TacImp _ _ s _) n ty sc) =
961 if size sc > breakingSize then
962 lbrace <> text "tacimp" <+> pretty n <+> colon <+> prettySe 10 ty <>
963 rbrace <+> text "->" $+$ prettySe 10 sc
965 lbrace <> text "tacimp" <+> pretty n <+> colon <+> prettySe 10 ty <>
966 rbrace <+> text "->" <+> prettySe 10 sc
967 prettySe p (PApp _ (PRef _ f) [])
968 | not impl = pretty f
969 prettySe p (PAppBind _ (PRef _ f) [])
970 | not impl = text "!" <+> pretty f
971 prettySe p (PApp _ (PRef _ op@(UN (f:_))) args)
972 | length (getExps args) == 2 && (not impl) && (not $ isAlpha f) =
973 let [l, r] = getExps args in
975 if size r > breakingSize then
976 prettySe 1 l <+> pretty op $+$ prettySe 0 r
978 prettySe 1 l <+> pretty op <+> prettySe 0 r
979 prettySe p (PApp _ f as) =
980 let args = getExps as in
985 -- foldr (<+>) empty $ map prettyArgS as
987 foldl' fSe empty args
988 -- foldr (<+>) empty $ map prettyArgSe args
991 if size r > breakingSize then
992 l $+$ nest nestingSize (prettyArgS r)
997 if size r > breakingSize then
998 l $+$ nest nestingSize (prettyArgSe r)
1001 prettySe p (PCase _ scr opts) =
1002 text "case" <+> prettySe 10 scr <+> text "of" $+$ nest nestingSize prettyBody
1004 prettyBody = foldr ($$) empty $ intersperse (text "|") $ map sc opts
1006 sc (l, r) = prettySe 10 l <+> text "=>" <+> prettySe 10 r
1007 prettySe p (PHidden tm) = text "." <> prettySe 0 tm
1008 prettySe p (PRefl _ _) = text "refl"
1009 prettySe p (PResolveTC _) = text "resolvetc"
1010 prettySe p (PTrue _) = text "()"
1011 prettySe p (PFalse _) = text "_|_"
1012 prettySe p (PEq _ l r) =
1014 if size r > breakingSize then
1015 prettySe 10 l <+> text "=" $$ nest nestingSize (prettySe 10 r)
1017 prettySe 10 l <+> text "=" <+> prettySe 10 r
1018 prettySe p (PRewrite _ l r _) =
1020 if size r > breakingSize then
1021 text "rewrite" <+> prettySe 10 l <+> text "in" $$ nest nestingSize (prettySe 10 r)
1023 text "rewrite" <+> prettySe 10 l <+> text "in" <+> prettySe 10 r
1024 prettySe p (PTyped l r) =
1025 lparen <> prettySe 10 l <+> colon <+> prettySe 10 r <> rparen
1026 prettySe p (PPair _ l r) =
1027 if size r > breakingSize then
1028 lparen <> prettySe 10 l <> text "," $+$
1029 prettySe 10 r <> rparen
1031 lparen <> prettySe 10 l <> text "," <+> prettySe 10 r <> rparen
1032 prettySe p (PDPair _ l t r) =
1033 if size r > breakingSize then
1034 lparen <> prettySe 10 l <+> text "**" $+$
1035 prettySe 10 r <> rparen
1037 lparen <> prettySe 10 l <+> text "**" <+> prettySe 10 r <> rparen
1038 prettySe p (PAlternative a as) =
1039 lparen <> text "|" <> prettyAs <> text "|" <> rparen
1042 foldr (\l -> \r -> l <+> text "," <+> r) empty $ map (prettySe 10) as
1043 prettySe p PType = text "Type"
1044 prettySe p (PConstant c) = pretty c
1045 -- XXX: add pretty for tactics
1046 prettySe p (PProof ts) =
1047 text "proof" <+> lbrace $+$ nest nestingSize (text . show $ ts) $+$ rbrace
1048 prettySe p (PTactics ts) =
1049 text "tactics" <+> lbrace $+$ nest nestingSize (text . show $ ts) $+$ rbrace
1050 prettySe p (PMetavar n) = text "?" <> pretty n
1051 prettySe p (PReturn f) = text "return"
1052 prettySe p PImpossible = text "impossible"
1053 prettySe p Placeholder = text "_"
1054 prettySe p (PDoBlock _) = text "do block pretty not implemented"
1055 prettySe p (PElabError s) = pretty s
1057 prettySe p _ = text "test"
1059 prettyArgS (PImp _ _ _ n tm _) = prettyArgSi (n, tm)
1060 prettyArgS (PExp _ _ tm _) = prettyArgSe tm
1061 prettyArgS (PConstraint _ _ tm _) = prettyArgSc tm
1062 prettyArgS (PTacImplicit _ _ n _ tm _) = prettyArgSti (n, tm)
1064 prettyArgSe arg = prettySe 0 arg
1065 prettyArgSi (n, val) = lbrace <> pretty n <+> text "=" <+> prettySe 10 val <> rbrace
1066 prettyArgSc val = lbrace <> lbrace <> prettySe 10 val <> rbrace <> rbrace
1067 prettyArgSti (n, val) = lbrace <> text "auto" <+> pretty n <+> text "=" <+> prettySe 10 val <> rbrace
1069 bracket outer inner doc
1070 | inner > outer = lparen <> doc <> rparen
1074showName :: Maybe IState -- ^^ the Idris state, for information about names and colours
1075 -> [(Name, Bool)] -- ^^ the bound variables and whether they're implicit
1076 -> Bool -- ^^ whether to show implicits
1077 -> Bool -- ^^ whether to colourise
1078 -> Name -- ^^ the term to show
1080showName ist bnd impl colour n = case ist of
1081 Just i -> if colour then colourise n (idris_colourTheme i) else showbasic n
1082 Nothing -> showbasic n
1083 where name = if impl then show n else showbasic n
1084 showbasic n@(UN _) = show n
1085 showbasic (MN _ s) = s
1086 showbasic (NS n s) = showSep "." (reverse s) ++ "." ++ showbasic n
1087 showbasic (SN s) = show s
1089 colourise n t = let ctxt' = fmap tt_ctxt ist in
1092 Just ctxt | Just impl <- lookup n bnd -> if impl then colouriseImplicit t name
1093 else colouriseBound t name
1094 | isDConName n ctxt -> colouriseData t name
1095 | isFnName n ctxt -> colouriseFun t name
1096 | isTConName n ctxt -> colouriseType t name
1097 -- The assumption is that if a name is not bound and does not exist in the
1098 -- global context, then we're somewhere in which implicit info has been lost
1099 -- (like error messages). Thus, unknown vars are colourised as implicits.
1100 | otherwise -> colouriseImplicit t name
1103showImp :: Maybe IState -- ^^ the Idris state, for information about identifiers and colours
1104 -> Bool -- ^^ whether to show implicits
1105 -> Bool -- ^^ whether to colourise
1106 -> PTerm -- ^^ the term to show
1108showImp ist impl colour tm = se 10 [] tm where
1109 perhapsColourise :: (ColourTheme -> String -> String) -> String -> String
1110 perhapsColourise col str = case ist of
1111 Just i -> if colour then col (idris_colourTheme i) str else str
1114 se :: Int -> [(Name, Bool)] -> PTerm -> String
1115 se p bnd (PQuote r) = "![" ++ show r ++ "]"
1116 se p bnd (PPatvar fc n) = if impl then show n ++ "[p]" else show n
1117 se p bnd (PInferRef fc n) = "!" ++ show n -- ++ "[" ++ show fc ++ "]"
1119 | Just str <- slist p bnd e = str
1120 | Just num <- snat p e = perhapsColourise colouriseData (show num)
1121 se p bnd (PRef fc n) = showName ist bnd impl colour n
1122 se p bnd (PLam n ty sc) = bracket p 2 $ "\\ " ++ perhapsColourise colouriseBound (show n) ++
1123 (if impl then " : " ++ se 10 bnd ty else "") ++ " => "
1124 ++ se 10 ((n, False):bnd) sc
1125 se p bnd (PLet n ty v sc) = bracket p 2 $ "let " ++ perhapsColourise colouriseBound (show n) ++
1126 " = " ++ se 10 bnd v ++
1127 " in " ++ se 10 ((n, False):bnd) sc
1128 se p bnd (PPi (Exp l s _) n ty sc)
1129 | n `elem` allNamesIn sc || impl
1131 (if l then "|(" else "(") ++
1132 perhapsColourise colouriseBound (show n) ++ " : " ++ se 10 bnd ty ++
1134 "-> " ++ se 10 ((n, False):bnd) sc
1135 | otherwise = bracket p 2 $ se 0 bnd ty ++ " " ++ st ++ "-> " ++ se 10 bnd sc
1136 where st = case s of
1137 Static -> "[static] "
1139 se p bnd (PPi (Imp l s _) n ty sc)
1140 | impl = bracket p 2 $ (if l then "|{" else "{") ++
1141 perhapsColourise colouriseBound (show n) ++ " : " ++ se 10 bnd ty ++
1142 "} " ++ st ++ "-> " ++ se 10 ((n, True):bnd) sc
1143 | otherwise = se 10 ((n, True):bnd) sc
1144 where st = case s of
1145 Static -> "[static] "
1147 se p bnd (PPi (Constraint _ _ _) n ty sc)
1148 = bracket p 2 $ se 10 bnd ty ++ " => " ++ se 10 bnd sc
1149 se p bnd (PPi (TacImp _ _ s _) n ty sc)
1151 "{tacimp " ++ (perhapsColourise colouriseBound (show n)) ++ " : " ++ se 10 bnd ty ++ "} -> " ++
1152 se 10 ((n, False):bnd) sc
1153 se p bnd (PMatchApp _ f) = "match " ++ show f
1154 se p bnd (PApp _ hd@(PRef _ f) [])
1155 | not impl = se p bnd hd
1156 se p bnd (PAppBind _ hd@(PRef _ f) [])
1157 | not impl = "!" ++ se p bnd hd
1158 se p bnd (PApp _ op@(PRef _ (UN (f:_))) args)
1159 | length (getExps args) == 2 && not impl && not (isAlpha f)
1160 = let [l, r] = getExps args in
1161 bracket p 1 $ se 1 bnd l ++ " " ++ se p bnd op ++ " " ++ se 0 bnd r
1162 se p bnd (PApp _ f as)
1163 = -- let args = getExps as in
1164 bracket p 1 $ se 1 bnd f ++
1165 if impl then concatMap (sArg bnd) as
1166 else concatMap (suiArg impl bnd) as
1167 se p bnd (PAppBind _ f as)
1168 = let args = getExps as in
1169 "!" ++ (bracket p 1 $ se 1 bnd f ++ if impl then concatMap (sArg bnd) as
1170 else concatMap (seArg bnd) args)
1171 se p bnd (PCase _ scr opts) = "case " ++ se 10 bnd scr ++ " of " ++ showSep " | " (map sc opts)
1172 where sc (l, r) = se 10 bnd l ++ " => " ++ se 10 bnd r
1173 se p bnd (PHidden tm) = "." ++ se 0 bnd tm
1174 se p bnd (PRefl _ t)
1175 | not impl = perhapsColourise colouriseData "refl"
1176 | otherwise = perhapsColourise colouriseData $ "refl {" ++ se 10 bnd t ++ "}"
1177 se p bnd (PResolveTC _) = "resolvetc"
1178 se p bnd (PTrue _) = perhapsColourise colouriseType "()"
1179 se p bnd (PFalse _) = perhapsColourise colouriseType "_|_"
1180 se p bnd (PEq _ l r) = bracket p 2 $ se 10 bnd l ++ perhapsColourise colouriseType " = " ++ se 10 bnd r
1181 se p bnd (PRewrite _ l r _) = bracket p 2 $ "rewrite " ++ se 10 bnd l ++ " in " ++ se 10 bnd r
1182 se p bnd (PTyped l r) = "(" ++ se 10 bnd l ++ " : " ++ se 10 bnd r ++ ")"
1183 se p bnd (PPair _ l r) = "(" ++ se 10 bnd l ++ ", " ++ se 10 bnd r ++ ")"
1184 se p bnd (PDPair _ l t r) = "(" ++ se 10 bnd l ++ " ** " ++ se 10 bnd r ++ ")"
1185 se p bnd (PAlternative a as) = "(|" ++ showSep " , " (map (se 10 bnd) as) ++ "|)"
1186 se p bnd PType = perhapsColourise colouriseType "Type"
1187 se p bnd (PConstant c) = perhapsColourise (cfun c) (show c)
1188 where cfun (AType _) = colouriseType
1189 cfun StrType = colouriseType
1190 cfun PtrType = colouriseType
1191 cfun VoidType = colouriseType
1192 cfun _ = colouriseData
1193 se p bnd (PProof ts) = "proof { " ++ show ts ++ "}"
1194 se p bnd (PTactics ts) = "tactics { " ++ show ts ++ "}"
1195 se p bnd (PMetavar n) = "?" ++ show n
1196 se p bnd (PReturn f) = "return"
1197 se p bnd PImpossible = "impossible"
1198 se p bnd Placeholder = "_"
1199 se p bnd (PDoBlock _) = "do block show not implemented"
1200 se p bnd (PElabError s) = show s
1201 se p bnd (PCoerced t) = se p bnd t
1202 se p bnd (PUnifyLog t) = "%unifyLog " ++ se p bnd t
1203 se p bnd (PNoImplicits t) = "%noimplicit " ++ se p bnd t
1204-- se p bnd x = "Not implemented"
1206 slist' p bnd (PApp _ (PRef _ nil) _)
1207 | nsroot nil == UN "Nil" = Just []
1208 slist' p bnd (PApp _ (PRef _ cons) args)
1209 | nsroot cons == UN "::",
1210 (PExp {getTm=tl}):(PExp {getTm=hd}):imps <- reverse args,
1212 Just tl' <- slist' p bnd tl
1215 isImp (PImp {}) = True
1217 slist' _ _ _ = Nothing
1219 slist p bnd e | Just es <- slist' p bnd e = Just $
1220 case es of [] -> "[]"
1221 [x] -> "[" ++ se p bnd x ++ "]"
1222 xs -> "[" ++ intercalate "," (map (se p bnd ) xs) ++ "]"
1223 slist _ _ _ = Nothing
1225 -- since Prelude is always imported, S & Z are unqualified iff they're the
1228 | show o == (natns++"Z") || show o == "Z" = Just 0
1229 snat p (PApp _ s [PExp {getTm=n}])
1230 | show s == (natns++"S") || show s == "S",
1235 natns = "Prelude.Nat."
1237 sArg bnd (PImp _ _ _ n tm _) = siArg bnd (n, tm)
1238 sArg bnd (PExp _ _ tm _) = seArg bnd tm
1239 sArg bnd (PConstraint _ _ tm _) = scArg bnd tm
1240 sArg bnd (PTacImplicit _ _ n _ tm _) = stiArg bnd (n, tm)
1242 -- show argument, implicits given by the user also shown
1243 suiArg impl bnd (PImp _ mi _ n tm _)
1244 | impl || not mi = siArg bnd (n, tm)
1245 suiArg impl bnd (PExp _ _ tm _) = seArg bnd tm
1246 suiArg impl bnd _ = ""
1248 seArg bnd arg = " " ++ se 0 bnd arg
1249 siArg bnd (n, val) =
1251 val' = se 10 bnd val in
1253 then " {" ++ n' ++ "}"
1254 else " {" ++ n' ++ " = " ++ val' ++ "}"
1255 scArg bnd val = " {{" ++ se 10 bnd val ++ "}}"
1256 stiArg bnd (n, val) = " {auto " ++ show n ++ " = " ++ se 10 bnd val ++ "}"
1258 bracket outer inner str | inner > outer = "(" ++ str ++ ")"
1262instance Sized PTerm where
1263 size (PQuote rawTerm) = size rawTerm
1264 size (PRef fc name) = size name
1265 size (PLam name ty bdy) = 1 + size ty + size bdy
1266 size (PPi plicity name ty bdy) = 1 + size ty + size bdy
1267 size (PLet name ty def bdy) = 1 + size ty + size def + size bdy
1268 size (PTyped trm ty) = 1 + size trm + size ty
1269 size (PApp fc name args) = 1 + size args
1270 size (PAppBind fc name args) = 1 + size args
1271 size (PCase fc trm bdy) = 1 + size trm + size bdy
1273 size (PFalse fc) = 1
1274 size (PRefl fc _) = 1
1275 size (PResolveTC fc) = 1
1276 size (PEq fc left right) = 1 + size left + size right
1277 size (PRewrite fc left right _) = 1 + size left + size right
1278 size (PPair fc left right) = 1 + size left + size right
1279 size (PDPair fs left ty right) = 1 + size left + size ty + size right
1280 size (PAlternative a alts) = 1 + size alts
1281 size (PHidden hidden) = size hidden
1282 size (PUnifyLog tm) = size tm
1283 size (PNoImplicits tm) = size tm
1285 size (PConstant const) = 1 + size const
1286 size Placeholder = 1
1287 size (PDoBlock dos) = 1 + size dos
1288 size (PIdiom fc term) = 1 + size term
1289 size (PReturn fc) = 1
1290 size (PMetavar name) = 1
1291 size (PProof tactics) = size tactics
1292 size (PElabError err) = size err
1293 size PImpossible = 1
1295getPArity :: PTerm -> Int
1296getPArity (PPi _ _ _ sc) = 1 + getPArity sc
1299-- Return all names, free or globally bound, in the given term.
1301allNamesIn :: PTerm -> [Name]
1302allNamesIn tm = nub $ ni [] tm
1305 | not (n `elem` env) = [n]
1306 ni env (PApp _ f as) = ni env f ++ concatMap (ni env) (map getTm as)
1307 ni env (PAppBind _ f as) = ni env f ++ concatMap (ni env) (map getTm as)
1308 ni env (PCase _ c os) = ni env c ++ concatMap (ni env) (map snd os)
1309 ni env (PLam n ty sc) = ni env ty ++ ni (n:env) sc
1310 ni env (PPi _ n ty sc) = ni env ty ++ ni (n:env) sc
1311 ni env (PHidden tm) = ni env tm
1312 ni env (PEq _ l r) = ni env l ++ ni env r
1313 ni env (PRewrite _ l r _) = ni env l ++ ni env r
1314 ni env (PTyped l r) = ni env l ++ ni env r
1315 ni env (PPair _ l r) = ni env l ++ ni env r
1316 ni env (PDPair _ (PRef _ n) t r) = ni env t ++ ni (n:env) r
1317 ni env (PDPair _ l t r) = ni env l ++ ni env t ++ ni env r
1318 ni env (PAlternative a ls) = concatMap (ni env) ls
1319 ni env (PUnifyLog tm) = ni env tm
1320 ni env (PNoImplicits tm) = ni env tm
1323-- Return names which are free in the given term.
1325namesIn :: [(Name, PTerm)] -> IState -> PTerm -> [Name]
1326namesIn uvars ist tm = nub $ ni [] tm
1329 | not (n `elem` env)
1330 = case lookupTy n (tt_ctxt ist) of
1332 _ -> if n `elem` (map fst uvars) then [n] else []
1333 ni env (PApp _ f as) = ni env f ++ concatMap (ni env) (map getTm as)
1334 ni env (PAppBind _ f as) = ni env f ++ concatMap (ni env) (map getTm as)
1335 ni env (PCase _ c os) = ni env c ++ concatMap (ni env) (map snd os)
1336 ni env (PLam n ty sc) = ni env ty ++ ni (n:env) sc
1337 ni env (PPi _ n ty sc) = ni env ty ++ ni (n:env) sc
1338 ni env (PEq _ l r) = ni env l ++ ni env r
1339 ni env (PRewrite _ l r _) = ni env l ++ ni env r
1340 ni env (PTyped l r) = ni env l ++ ni env r
1341 ni env (PPair _ l r) = ni env l ++ ni env r
1342 ni env (PDPair _ (PRef _ n) t r) = ni env t ++ ni (n:env) r
1343 ni env (PDPair _ l t r) = ni env l ++ ni env t ++ ni env r
1344 ni env (PAlternative a as) = concatMap (ni env) as
1345 ni env (PHidden tm) = ni env tm
1346 ni env (PUnifyLog tm) = ni env tm
1347 ni env (PNoImplicits tm) = ni env tm
1350-- Return which of the given names are used in the given term.
1352usedNamesIn :: [Name] -> IState -> PTerm -> [Name]
1353usedNamesIn vars ist tm = nub $ ni [] tm
1356 | n `elem` vars && not (n `elem` env)
1357 = case lookupTy n (tt_ctxt ist) of
1360 ni env (PApp _ f as) = ni env f ++ concatMap (ni env) (map getTm as)
1361 ni env (PAppBind _ f as) = ni env f ++ concatMap (ni env) (map getTm as)
1362 ni env (PCase _ c os) = ni env c ++ concatMap (ni env) (map snd os)
1363 ni env (PLam n ty sc) = ni env ty ++ ni (n:env) sc
1364 ni env (PPi _ n ty sc) = ni env ty ++ ni (n:env) sc
1365 ni env (PEq _ l r) = ni env l ++ ni env r
1366 ni env (PRewrite _ l r _) = ni env l ++ ni env r
1367 ni env (PTyped l r) = ni env l ++ ni env r
1368 ni env (PPair _ l r) = ni env l ++ ni env r
1369 ni env (PDPair _ (PRef _ n) t r) = ni env t ++ ni (n:env) r
1370 ni env (PDPair _ l t r) = ni env l ++ ni env t ++ ni env r
1371 ni env (PAlternative a as) = concatMap (ni env) as
1372 ni env (PHidden tm) = ni env tm
1373 ni env (PUnifyLog tm) = ni env tm
1374 ni env (PNoImplicits tm) = ni env tm
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