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_lineapps :: [((FilePath, Int), PTerm)],
104 -- ^ Full application LHS on source line
105 idris_metavars :: [Name], -- ^ The currently defined but not proven metavariables
106 idris_coercions :: [Name],
107 idris_transforms :: [(Term, Term)],
108 syntax_rules :: [Syntax],
109 syntax_keywords :: [String],
110 imported :: [FilePath], -- ^ The imported modules
111 idris_scprims :: [(Name, (Int, PrimFn))],
112 idris_objs :: [(Codegen, FilePath)],
113 idris_libs :: [(Codegen, String)],
114 idris_cgflags :: [(Codegen, String)],
115 idris_hdrs :: [(Codegen, String)],
116 proof_list :: [(Name, [String])],
117 errLine :: Maybe Int,
118 lastParse :: Maybe Name,
119 indent_stack :: [Int],
120 brace_stack :: [Maybe Int],
121 hide_list :: [(Name, Maybe Accessibility)],
122 default_access :: Accessibility,
123 default_total :: Bool,
124 ibc_write :: [IBCWrite],
125 compiled_so :: Maybe String,
126 idris_dynamic_libs :: [DynamicLib],
127 idris_language_extensions :: [LanguageExt],
128 idris_outputmode :: OutputMode,
129 idris_colourRepl :: Bool,
130 idris_colourTheme :: ColourTheme
133data SizeChange = Smaller | Same | Bigger | Unknown
136deriving instance Binary SizeChange
139type SCGEntry = (Name, [Maybe (Int, SizeChange)])
141data CGInfo = CGInfo { argsdef :: [Name],
142 calls :: [(Name, [[Name]])],
148deriving instance Binary CGInfo
151primDefs = [UN "unsafePerformPrimIO",
152 UN "mkLazyForeignPrim",
156-- information that needs writing for the current module's .ibc file
157data IBCWrite = IBCFix FixDecl
161 | IBCInstance Bool Name Name
168 | IBCObj Codegen FilePath
169 | IBCLib Codegen String
170 | IBCCGFlag Codegen String
172 | IBCHeader Codegen String
173 | IBCAccess Name Accessibility
174 | IBCTotal Name Totality
175 | IBCFlags Name [FnOpt]
176 | IBCTrans (Term, Term)
180 | IBCDef Name -- i.e. main context
181 | IBCLineApp FilePath Int PTerm
184idrisInit = IState initContext [] [] emptyContext emptyContext emptyContext
185 emptyContext emptyContext emptyContext emptyContext
186 emptyContext emptyContext emptyContext emptyContext
187 [] "" defaultOpts 6 [] [] [] [] [] [] [] [] [] [] [] []
188 [] Nothing Nothing [] [] [] Hidden False [] Nothing [] [] RawOutput
191-- | The monad for the main REPL - reading and processing files and updating
192-- global state (hence the IO inner monad).
193--type Idris = WriterT [Either String (IO ())] (State IState a))
194type Idris = StateT IState (ErrorT Err IO)
196-- Commands in the REPL
215 | ChangeDirectory FilePath
218 | Compile Codegen String
223 | AddProof (Maybe Name)
236 | DynamicLink FilePath
241 | CaseSplit Name PTerm
242 | CaseSplitAt Int Name
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 extra 'with' patterns
421-- 3. The right-hand side
423-- 4. The where block (PDecl' t)
425data PClause' t = PClause FC Name t [t] t [PDecl' t] -- ^ A normal top-level definition.
426 | PWith FC Name t [t] t [PDecl' t]
427 | PClauseR FC [t] t [PDecl' t]
428 | PWithR FC [t] t [PDecl' t]
431deriving instance Binary PClause'
435data PData' t = PDatadecl { d_name :: Name, -- ^ The name of the datatype
436 d_tcon :: t, -- ^ Type constructor
437 d_cons :: [(String, Name, t, FC)] -- ^ Constructors
439 -- ^ Data declaration
440 | PLaterdecl { d_name :: Name, d_tcon :: t }
441 -- ^ "Placeholder" for data whose constructors are defined later
444deriving instance Binary PData'
447-- Handy to get a free function for applying PTerm -> PTerm functions
448-- across a program, by deriving Functor
450type PDecl = PDecl' PTerm
451type PData = PData' PTerm
452type PClause = PClause' PTerm
454-- get all the names declared in a decl
456declared :: PDecl -> [Name]
457declared (PFix _ _ _) = []
458declared (PTy _ _ _ _ n t) = [n]
459declared (PPostulate _ _ _ _ n t) = [n]
460declared (PClauses _ _ n _) = [] -- not a declaration
461declared (PCAF _ n _) = [n]
462declared (PData _ _ _ _ (PDatadecl n _ ts)) = n : map fstt ts
463 where fstt (_, a, _, _) = a
464declared (PData _ _ _ _ (PLaterdecl n _)) = [n]
465declared (PParams _ _ ds) = concatMap declared ds
466declared (PNamespace _ ds) = concatMap declared ds
467declared (PRecord _ _ _ n _ _ c _) = [n, c]
468declared (PClass _ _ _ _ n _ ms) = n : concatMap declared ms
469declared (PInstance _ _ _ _ _ _ _ _) = []
470declared (PDSL n _) = [n]
471declared (PSyntax _ _) = []
472declared (PMutual _ ds) = concatMap declared ds
473declared (PDirective _) = []
475-- get the names declared, not counting nested parameter blocks
476tldeclared :: PDecl -> [Name]
477tldeclared (PFix _ _ _) = []
478tldeclared (PTy _ _ _ _ n t) = [n]
479tldeclared (PPostulate _ _ _ _ n t) = [n]
480tldeclared (PClauses _ _ n _) = [] -- not a declaration
481tldeclared (PRecord _ _ _ n _ _ c _) = [n, c]
482tldeclared (PData _ _ _ _ (PDatadecl n _ ts)) = n : map fstt ts
483 where fstt (_, a, _, _) = a
484tldeclared (PParams _ _ ds) = []
485tldeclared (PMutual _ ds) = concatMap tldeclared ds
486tldeclared (PNamespace _ ds) = concatMap tldeclared ds
487tldeclared (PClass _ _ _ _ n _ ms) = concatMap tldeclared ms
488tldeclared (PInstance _ _ _ _ _ _ _ _) = []
491defined :: PDecl -> [Name]
492defined (PFix _ _ _) = []
493defined (PTy _ _ _ _ n t) = []
494defined (PPostulate _ _ _ _ n t) = []
495defined (PClauses _ _ n _) = [n] -- not a declaration
496defined (PCAF _ n _) = [n]
497defined (PData _ _ _ _ (PDatadecl n _ ts)) = n : map fstt ts
498 where fstt (_, a, _, _) = a
499defined (PData _ _ _ _ (PLaterdecl n _)) = []
500defined (PParams _ _ ds) = concatMap defined ds
501defined (PNamespace _ ds) = concatMap defined ds
502defined (PRecord _ _ _ n _ _ c _) = [n, c]
503defined (PClass _ _ _ _ n _ ms) = n : concatMap defined ms
504defined (PInstance _ _ _ _ _ _ _ _) = []
505defined (PDSL n _) = [n]
506defined (PSyntax _ _) = []
507defined (PMutual _ ds) = concatMap defined ds
508defined (PDirective _) = []
511updateN :: [(Name, Name)] -> Name -> Name
512updateN ns n | Just n' <- lookup n ns = n'
515updateNs :: [(Name, Name)] -> PTerm -> PTerm
517updateNs ns t = mapPT updateRef t
518 where updateRef (PRef fc f) = PRef fc (updateN ns f)
521-- updateDNs :: [(Name, Name)] -> PDecl -> PDecl
523-- updateDNs ns (PTy s f n t) | Just n' <- lookup n ns = PTy s f n' t
524-- updateDNs ns (PClauses f n c) | Just n' <- lookup n ns = PClauses f n' (map updateCNs c)
525-- where updateCNs ns (PClause n l ts r ds)
526-- = PClause (updateN ns n) (fmap (updateNs ns) l)
527-- (map (fmap (updateNs ns)) ts)
528-- (fmap (updateNs ns) r)
529-- (map (updateDNs ns) ds)
532-- | High level language terms
533data PTerm = PQuote Raw
535 | PInferRef FC Name -- ^ A name to be defined later
537 | PLam Name PTerm PTerm
538 | PPi Plicity Name PTerm PTerm
539 | PLet Name PTerm PTerm PTerm
540 | PTyped PTerm PTerm -- ^ Term with explicit type
541 | PApp FC PTerm [PArg]
542 | PAppBind FC PTerm [PArg] -- ^ implicitly bound application
543 | PMatchApp FC Name -- ^ Make an application by type matching
544 | PCase FC PTerm [(PTerm, PTerm)]
550 | PRewrite FC PTerm PTerm (Maybe PTerm)
551 | PPair FC PTerm PTerm
552 | PDPair FC PTerm PTerm PTerm
553 | PAlternative Bool [PTerm] -- True if only one may work
554 | PHidden PTerm -- ^ Irrelevant or hidden pattern
556 | PGoal FC PTerm Name PTerm
563 | PProof [PTactic] -- ^ Proof script
564 | PTactics [PTactic] -- ^ As PProof, but no auto solving
565 | PElabError Err -- ^ Error to report on elaboration
566 | PImpossible -- ^ Special case for declaring when an LHS can't typecheck
567 | PCoerced PTerm -- ^ To mark a coerced argument, so as not to coerce twice
568 | PUnifyLog PTerm -- ^ dump a trace of unifications when building term
569 | PNoImplicits PTerm -- ^ never run implicit converions on the term
574deriving instance Binary PTerm
577mapPT :: (PTerm -> PTerm) -> PTerm -> PTerm
578mapPT f t = f (mpt t) where
579 mpt (PLam n t s) = PLam n (mapPT f t) (mapPT f s)
580 mpt (PPi p n t s) = PPi p n (mapPT f t) (mapPT f s)
581 mpt (PLet n ty v s) = PLet n (mapPT f ty) (mapPT f v) (mapPT f s)
582 mpt (PRewrite fc t s g) = PRewrite fc (mapPT f t) (mapPT f s)
584 mpt (PApp fc t as) = PApp fc (mapPT f t) (map (fmap (mapPT f)) as)
585 mpt (PAppBind fc t as) = PAppBind fc (mapPT f t) (map (fmap (mapPT f)) as)
586 mpt (PCase fc c os) = PCase fc (mapPT f c) (map (pmap (mapPT f)) os)
587 mpt (PEq fc l r) = PEq fc (mapPT f l) (mapPT f r)
588 mpt (PTyped l r) = PTyped (mapPT f l) (mapPT f r)
589 mpt (PPair fc l r) = PPair fc (mapPT f l) (mapPT f r)
590 mpt (PDPair fc l t r) = PDPair fc (mapPT f l) (mapPT f t) (mapPT f r)
591 mpt (PAlternative a as) = PAlternative a (map (mapPT f) as)
592 mpt (PHidden t) = PHidden (mapPT f t)
593 mpt (PDoBlock ds) = PDoBlock (map (fmap (mapPT f)) ds)
594 mpt (PProof ts) = PProof (map (fmap (mapPT f)) ts)
595 mpt (PTactics ts) = PTactics (map (fmap (mapPT f)) ts)
596 mpt (PUnifyLog tm) = PUnifyLog (mapPT f tm)
597 mpt (PNoImplicits tm) = PNoImplicits (mapPT f tm)
598 mpt (PGoal fc r n sc) = PGoal fc (mapPT f r) n (mapPT f sc)
602data PTactic' t = Intro [Name] | Intros | Focus Name
603 | Refine Name [Bool] | Rewrite t
606 | LetTac Name t | LetTacTy Name t t
607 | Exact t | Compute | Trivial
610 | ProofState | ProofTerm | Undo
611 | Try (PTactic' t) (PTactic' t)
612 | TSeq (PTactic' t) (PTactic' t)
613 | ApplyTactic t -- see Language.Reflection module
616 | GoalType String (PTactic' t)
618 deriving (Show, Eq, Functor)
620deriving instance Binary PTactic'
623instance Sized a => Sized (PTactic' a) where
624 size (Intro nms) = 1 + size nms
626 size (Focus nm) = 1 + size nm
627 size (Refine nm bs) = 1 + size nm + length bs
628 size (Rewrite t) = 1 + size t
629 size (LetTac nm t) = 1 + size nm + size t
630 size (Exact t) = 1 + size t
638 size (Try l r) = 1 + size l + size r
639 size (TSeq l r) = 1 + size l + size r
640 size (ApplyTactic t) = 1 + size t
641 size (Reflect t) = 1 + size t
642 size (Fill t) = 1 + size t
646type PTactic = PTactic' PTerm
648data PDo' t = DoExp FC t
653 deriving (Eq, Functor)
655deriving instance Binary PDo'
658instance Sized a => Sized (PDo' a) where
659 size (DoExp fc t) = 1 + size fc + size t
660 size (DoBind fc nm t) = 1 + size fc + size nm + size t
661 size (DoBindP fc l r) = 1 + size fc + size l + size r
662 size (DoLet fc nm l r) = 1 + size fc + size nm + size l + size r
663 size (DoLetP fc l r) = 1 + size fc + size l + size r
667-- The priority gives a hint as to elaboration order. Best to elaborate
668-- things early which will help give a more concrete type to other
669-- variables, e.g. a before (interpTy a).
671data PArg' t = PImp { priority :: Int,
672 machine_inf :: Bool, -- true if the machine inferred it
673 lazyarg :: Bool, pname :: Name, getTm :: t,
675 | PExp { priority :: Int,
676 lazyarg :: Bool, getTm :: t,
678 | PConstraint { priority :: Int,
679 lazyarg :: Bool, getTm :: t,
681 | PTacImplicit { priority :: Int,
682 lazyarg :: Bool, pname :: Name,
686 deriving (Show, Eq, Functor)
688instance Sized a => Sized (PArg' a) where
689 size (PImp p _ l nm trm _) = 1 + size nm + size trm
690 size (PExp p l trm _) = 1 + size trm
691 size (PConstraint p l trm _) = 1 + size trm
692 size (PTacImplicit p l nm scr trm _) = 1 + size nm + size scr + size trm
695deriving instance Binary PArg'
698pimp n t mach = PImp 1 mach True n t ""
699pexp t = PExp 1 False t ""
700pconst t = PConstraint 1 False t ""
701ptacimp n s t = PTacImplicit 0 True n s t ""
703type PArg = PArg' PTerm
707data ClassInfo = CI { instanceName :: Name,
708 class_methods :: [(Name, (FnOpts, PTerm))],
709 class_defaults :: [(Name, (Name, PDecl))], -- method name -> default impl
710 class_params :: [Name],
711 class_instances :: [Name] }
714deriving instance Binary ClassInfo
717data OptInfo = Optimise { collapsible :: Bool,
719 forceable :: [Int], -- argument positions
723deriving instance Binary OptInfo
727data TypeInfo = TI { con_names :: [Name],
732deriving instance Binary TypeInfo
735-- Syntactic sugar info
737data DSL' t = DSL { dsl_bind :: t,
742 index_first :: Maybe t,
743 index_next :: Maybe t,
744 dsl_lambda :: Maybe t,
747 deriving (Show, Functor)
749deriving instance Binary DSL'
754data SynContext = PatternSyntax | TermSyntax | AnySyntax
757deriving instance Binary SynContext
760data Syntax = Rule [SSymbol] PTerm SynContext
763deriving instance Binary Syntax
766data SSymbol = Keyword Name
773deriving instance Binary SSymbol
776initDSL = DSL (PRef f (UN ">>="))
777 (PRef f (UN "return"))
785 where f = fileFC "(builtin)"
787data Using = UImplicit Name PTerm
788 | UConstraint Name [Name]
791deriving instance Binary Using
794data SyntaxInfo = Syn { using :: [Using],
795 syn_params :: [(Name, PTerm)],
796 syn_namespace :: [String],
798 decoration :: Name -> Name,
800 implicitAllowed :: Bool,
804deriving instance Binary SyntaxInfo
807defaultSyntax = Syn [] [] [] [] id False False initDSL
809expandNS :: SyntaxInfo -> Name -> Name
810expandNS syn n@(NS _ _) = n
811expandNS syn n = case syn_namespace syn of
816--- Pretty printing declarations and terms
818instance Show PTerm where
819 show tm = showImp Nothing False False tm
821instance Pretty PTerm where
822 pretty = prettyImp False
824instance Show PDecl where
825 show d = showDeclImp False d
827instance Show PClause where
828 show c = showCImp True c
830instance Show PData where
831 show d = showDImp False d
833showDeclImp _ (PFix _ f ops) = show f ++ " " ++ showSep ", " ops
834showDeclImp t (PTy _ _ _ _ n ty) = show n ++ " : " ++ showImp Nothing t False ty
835showDeclImp t (PPostulate _ _ _ _ n ty) = show n ++ " : " ++ showImp Nothing t False ty
836showDeclImp _ (PClauses _ _ n c) = showSep "\n" (map show c)
837showDeclImp _ (PData _ _ _ _ d) = show d
838showDeclImp _ (PParams f ns ps) = "parameters " ++ show ns ++ "\n" ++
839 showSep "\n" (map show ps)
842showCImp :: Bool -> PClause -> String
843showCImp impl (PClause _ n l ws r w)
844 = showImp Nothing impl False l ++ showWs ws ++ " = " ++ showImp Nothing impl False r
845 ++ " where " ++ show w
848 showWs (x : xs) = " | " ++ showImp Nothing impl False x ++ showWs xs
849showCImp impl (PWith _ n l ws r w)
850 = showImp Nothing impl False l ++ showWs ws ++ " with " ++ showImp Nothing impl False r
851 ++ " { " ++ show w ++ " } "
854 showWs (x : xs) = " | " ++ showImp Nothing impl False x ++ showWs xs
857showDImp :: Bool -> PData -> String
858showDImp impl (PDatadecl n ty cons)
859 = "data " ++ show n ++ " : " ++ showImp Nothing impl False ty ++ " where\n\t"
861 (map (\ (_, n, t, _) -> show n ++ " : " ++ showImp Nothing impl False t) cons)
863getImps :: [PArg] -> [(Name, PTerm)]
865getImps (PImp _ _ _ n tm _ : xs) = (n, tm) : getImps xs
866getImps (_ : xs) = getImps xs
868getExps :: [PArg] -> [PTerm]
870getExps (PExp _ _ tm _ : xs) = tm : getExps xs
871getExps (_ : xs) = getExps xs
873getConsts :: [PArg] -> [PTerm]
875getConsts (PConstraint _ _ tm _ : xs) = tm : getConsts xs
876getConsts (_ : xs) = getConsts xs
878getAll :: [PArg] -> [PTerm]
881-- | Pretty-print a high-level Idris term
882prettyImp :: Bool -- ^^ whether to show implicits
883 -> PTerm -- ^^ the term to pretty-print
885prettyImp impl = prettySe 10
887 prettySe p (PQuote r) =
888 if size r > breakingSize then
889 text "![" $$ pretty r <> text "]"
891 text "![" <> pretty r <> text "]"
892 prettySe p (PPatvar fc n) = pretty n
893 prettySe p (PRef fc n) =
899 prettyBasic n@(UN _) = pretty n
900 prettyBasic (MN _ s) = text s
901 prettyBasic (NS n s) = (foldr (<>) empty (intersperse (text ".") (map text $ reverse s))) <> prettyBasic n
902 prettyBasic (SN sn) = text (show sn)
903 prettySe p (PLam n ty sc) =
905 if size sc > breakingSize then
906 text "λ" <> pretty n <+> text "=>" $+$ pretty sc
908 text "λ" <> pretty n <+> text "=>" <+> pretty sc
909 prettySe p (PLet n ty v sc) =
911 if size sc > breakingSize then
912 text "let" <+> pretty n <+> text "=" <+> prettySe 10 v <+> text "in" $+$
913 nest nestingSize (prettySe 10 sc)
915 text "let" <+> pretty n <+> text "=" <+> prettySe 10 v <+> text "in" <+>
917 prettySe p (PPi (Exp l s _) n ty sc)
918 | n `elem` allNamesIn sc || impl =
919 let open = if l then text "|" <> lparen else lparen in
921 if size sc > breakingSize then
922 open <> pretty n <+> colon <+> prettySe 10 ty <> rparen <+>
923 st <+> text "->" $+$ prettySe 10 sc
925 open <> pretty n <+> colon <+> prettySe 10 ty <> rparen <+>
926 st <+> text "->" <+> prettySe 10 sc
929 if size sc > breakingSize then
930 prettySe 0 ty <+> st <+> text "->" $+$ prettySe 10 sc
932 prettySe 0 ty <+> st <+> text "->" <+> prettySe 10 sc
936 Static -> text "[static]"
938 prettySe p (PPi (Imp l s _) n ty sc)
940 let open = if l then text "|" <> lbrace else lbrace in
942 if size sc > breakingSize then
943 open <> pretty n <+> colon <+> prettySe 10 ty <> rbrace <+>
944 st <+> text "->" <+> prettySe 10 sc
946 open <> pretty n <+> colon <+> prettySe 10 ty <> rbrace <+>
947 st <+> text "->" <+> prettySe 10 sc
948 | otherwise = prettySe 10 sc
952 Static -> text $ "[static]"
954 prettySe p (PPi (Constraint _ _ _) n ty sc) =
956 if size sc > breakingSize then
957 prettySe 10 ty <+> text "=>" <+> prettySe 10 sc
959 prettySe 10 ty <+> text "=>" $+$ prettySe 10 sc
960 prettySe p (PPi (TacImp _ _ s _) n ty sc) =
962 if size sc > breakingSize then
963 lbrace <> text "tacimp" <+> pretty n <+> colon <+> prettySe 10 ty <>
964 rbrace <+> text "->" $+$ prettySe 10 sc
966 lbrace <> text "tacimp" <+> pretty n <+> colon <+> prettySe 10 ty <>
967 rbrace <+> text "->" <+> prettySe 10 sc
968 prettySe p (PApp _ (PRef _ f) [])
969 | not impl = pretty f
970 prettySe p (PAppBind _ (PRef _ f) [])
971 | not impl = text "!" <+> pretty f
972 prettySe p (PApp _ (PRef _ op@(UN (f:_))) args)
973 | length (getExps args) == 2 && (not impl) && (not $ isAlpha f) =
974 let [l, r] = getExps args in
976 if size r > breakingSize then
977 prettySe 1 l <+> pretty op $+$ prettySe 0 r
979 prettySe 1 l <+> pretty op <+> prettySe 0 r
980 prettySe p (PApp _ f as) =
981 let args = getExps as in
986 -- foldr (<+>) empty $ map prettyArgS as
988 foldl' fSe empty args
989 -- foldr (<+>) empty $ map prettyArgSe args
992 if size r > breakingSize then
993 l $+$ nest nestingSize (prettyArgS r)
998 if size r > breakingSize then
999 l $+$ nest nestingSize (prettyArgSe r)
1002 prettySe p (PCase _ scr opts) =
1003 text "case" <+> prettySe 10 scr <+> text "of" $+$ nest nestingSize prettyBody
1005 prettyBody = foldr ($$) empty $ intersperse (text "|") $ map sc opts
1007 sc (l, r) = prettySe 10 l <+> text "=>" <+> prettySe 10 r
1008 prettySe p (PHidden tm) = text "." <> prettySe 0 tm
1009 prettySe p (PRefl _ _) = text "refl"
1010 prettySe p (PResolveTC _) = text "resolvetc"
1011 prettySe p (PTrue _) = text "()"
1012 prettySe p (PFalse _) = text "_|_"
1013 prettySe p (PEq _ l r) =
1015 if size r > breakingSize then
1016 prettySe 10 l <+> text "=" $$ nest nestingSize (prettySe 10 r)
1018 prettySe 10 l <+> text "=" <+> prettySe 10 r
1019 prettySe p (PRewrite _ l r _) =
1021 if size r > breakingSize then
1022 text "rewrite" <+> prettySe 10 l <+> text "in" $$ nest nestingSize (prettySe 10 r)
1024 text "rewrite" <+> prettySe 10 l <+> text "in" <+> prettySe 10 r
1025 prettySe p (PTyped l r) =
1026 lparen <> prettySe 10 l <+> colon <+> prettySe 10 r <> rparen
1027 prettySe p (PPair _ l r) =
1028 if size r > breakingSize then
1029 lparen <> prettySe 10 l <> text "," $+$
1030 prettySe 10 r <> rparen
1032 lparen <> prettySe 10 l <> text "," <+> prettySe 10 r <> rparen
1033 prettySe p (PDPair _ l t r) =
1034 if size r > breakingSize then
1035 lparen <> prettySe 10 l <+> text "**" $+$
1036 prettySe 10 r <> rparen
1038 lparen <> prettySe 10 l <+> text "**" <+> prettySe 10 r <> rparen
1039 prettySe p (PAlternative a as) =
1040 lparen <> text "|" <> prettyAs <> text "|" <> rparen
1043 foldr (\l -> \r -> l <+> text "," <+> r) empty $ map (prettySe 10) as
1044 prettySe p PType = text "Type"
1045 prettySe p (PConstant c) = pretty c
1046 -- XXX: add pretty for tactics
1047 prettySe p (PProof ts) =
1048 text "proof" <+> lbrace $+$ nest nestingSize (text . show $ ts) $+$ rbrace
1049 prettySe p (PTactics ts) =
1050 text "tactics" <+> lbrace $+$ nest nestingSize (text . show $ ts) $+$ rbrace
1051 prettySe p (PMetavar n) = text "?" <> pretty n
1052 prettySe p (PReturn f) = text "return"
1053 prettySe p PImpossible = text "impossible"
1054 prettySe p Placeholder = text "_"
1055 prettySe p (PDoBlock _) = text "do block pretty not implemented"
1056 prettySe p (PElabError s) = pretty s
1058 prettySe p _ = text "test"
1060 prettyArgS (PImp _ _ _ n tm _) = prettyArgSi (n, tm)
1061 prettyArgS (PExp _ _ tm _) = prettyArgSe tm
1062 prettyArgS (PConstraint _ _ tm _) = prettyArgSc tm
1063 prettyArgS (PTacImplicit _ _ n _ tm _) = prettyArgSti (n, tm)
1065 prettyArgSe arg = prettySe 0 arg
1066 prettyArgSi (n, val) = lbrace <> pretty n <+> text "=" <+> prettySe 10 val <> rbrace
1067 prettyArgSc val = lbrace <> lbrace <> prettySe 10 val <> rbrace <> rbrace
1068 prettyArgSti (n, val) = lbrace <> text "auto" <+> pretty n <+> text "=" <+> prettySe 10 val <> rbrace
1070 bracket outer inner doc
1071 | inner > outer = lparen <> doc <> rparen
1075showName :: Maybe IState -- ^^ the Idris state, for information about names and colours
1076 -> [(Name, Bool)] -- ^^ the bound variables and whether they're implicit
1077 -> Bool -- ^^ whether to show implicits
1078 -> Bool -- ^^ whether to colourise
1079 -> Name -- ^^ the term to show
1081showName ist bnd impl colour n = case ist of
1082 Just i -> if colour then colourise n (idris_colourTheme i) else showbasic n
1083 Nothing -> showbasic n
1084 where name = if impl then show n else showbasic n
1085 showbasic n@(UN _) = show n
1086 showbasic (MN _ s) = s
1087 showbasic (NS n s) = showSep "." (reverse s) ++ "." ++ showbasic n
1088 showbasic (SN s) = show s
1090 colourise n t = let ctxt' = fmap tt_ctxt ist in
1093 Just ctxt | Just impl <- lookup n bnd -> if impl then colouriseImplicit t name
1094 else colouriseBound t name
1095 | isDConName n ctxt -> colouriseData t name
1096 | isFnName n ctxt -> colouriseFun t name
1097 | isTConName n ctxt -> colouriseType t name
1098 -- The assumption is that if a name is not bound and does not exist in the
1099 -- global context, then we're somewhere in which implicit info has been lost
1100 -- (like error messages). Thus, unknown vars are colourised as implicits.
1101 | otherwise -> colouriseImplicit t name
1104showImp :: Maybe IState -- ^^ the Idris state, for information about identifiers and colours
1105 -> Bool -- ^^ whether to show implicits
1106 -> Bool -- ^^ whether to colourise
1107 -> PTerm -- ^^ the term to show
1109showImp ist impl colour tm = se 10 [] tm where
1110 perhapsColourise :: (ColourTheme -> String -> String) -> String -> String
1111 perhapsColourise col str = case ist of
1112 Just i -> if colour then col (idris_colourTheme i) str else str
1115 se :: Int -> [(Name, Bool)] -> PTerm -> String
1116 se p bnd (PQuote r) = "![" ++ show r ++ "]"
1117 se p bnd (PPatvar fc n) = if impl then show n ++ "[p]" else show n
1118 se p bnd (PInferRef fc n) = "!" ++ show n -- ++ "[" ++ show fc ++ "]"
1120 | Just str <- slist p bnd e = str
1121 | Just num <- snat p e = perhapsColourise colouriseData (show num)
1122 se p bnd (PRef fc n) = showName ist bnd impl colour n
1123 se p bnd (PLam n ty sc) = bracket p 2 $ "\\ " ++ perhapsColourise colouriseBound (show n) ++
1124 (if impl then " : " ++ se 10 bnd ty else "") ++ " => "
1125 ++ se 10 ((n, False):bnd) sc
1126 se p bnd (PLet n ty v sc) = bracket p 2 $ "let " ++ perhapsColourise colouriseBound (show n) ++
1127 " = " ++ se 10 bnd v ++
1128 " in " ++ se 10 ((n, False):bnd) sc
1129 se p bnd (PPi (Exp l s _) n ty sc)
1130 | n `elem` allNamesIn sc || impl
1132 (if l then "|(" else "(") ++
1133 perhapsColourise colouriseBound (show n) ++ " : " ++ se 10 bnd ty ++
1135 "-> " ++ se 10 ((n, False):bnd) sc
1136 | otherwise = bracket p 2 $ se 0 bnd ty ++ " " ++ st ++ "-> " ++ se 10 bnd sc
1137 where st = case s of
1138 Static -> "[static] "
1140 se p bnd (PPi (Imp l s _) n ty sc)
1141 | impl = bracket p 2 $ (if l then "|{" else "{") ++
1142 perhapsColourise colouriseBound (show n) ++ " : " ++ se 10 bnd ty ++
1143 "} " ++ st ++ "-> " ++ se 10 ((n, True):bnd) sc
1144 | otherwise = se 10 ((n, True):bnd) sc
1145 where st = case s of
1146 Static -> "[static] "
1148 se p bnd (PPi (Constraint _ _ _) n ty sc)
1149 = bracket p 2 $ se 10 bnd ty ++ " => " ++ se 10 bnd sc
1150 se p bnd (PPi (TacImp _ _ s _) n ty sc)
1152 "{tacimp " ++ (perhapsColourise colouriseBound (show n)) ++ " : " ++ se 10 bnd ty ++ "} -> " ++
1153 se 10 ((n, False):bnd) sc
1154 se p bnd (PMatchApp _ f) = "match " ++ show f
1155 se p bnd (PApp _ hd@(PRef _ f) [])
1156 | not impl = se p bnd hd
1157 se p bnd (PAppBind _ hd@(PRef _ f) [])
1158 | not impl = "!" ++ se p bnd hd
1159 se p bnd (PApp _ op@(PRef _ (UN (f:_))) args)
1160 | length (getExps args) == 2 && not impl && not (isAlpha f)
1161 = let [l, r] = getExps args in
1162 bracket p 1 $ se 1 bnd l ++ " " ++ se p bnd op ++ " " ++ se 0 bnd r
1163 se p bnd (PApp _ f as)
1164 = -- let args = getExps as in
1165 bracket p 1 $ se 1 bnd f ++
1166 if impl then concatMap (sArg bnd) as
1167 else concatMap (suiArg impl bnd) as
1168 se p bnd (PAppBind _ f as)
1169 = let args = getExps as in
1170 "!" ++ (bracket p 1 $ se 1 bnd f ++ if impl then concatMap (sArg bnd) as
1171 else concatMap (seArg bnd) args)
1172 se p bnd (PCase _ scr opts) = "case " ++ se 10 bnd scr ++ " of " ++ showSep " | " (map sc opts)
1173 where sc (l, r) = se 10 bnd l ++ " => " ++ se 10 bnd r
1174 se p bnd (PHidden tm) = "." ++ se 0 bnd tm
1175 se p bnd (PRefl _ t)
1176 | not impl = perhapsColourise colouriseData "refl"
1177 | otherwise = perhapsColourise colouriseData $ "refl {" ++ se 10 bnd t ++ "}"
1178 se p bnd (PResolveTC _) = "resolvetc"
1179 se p bnd (PTrue _) = perhapsColourise colouriseType "()"
1180 se p bnd (PFalse _) = perhapsColourise colouriseType "_|_"
1181 se p bnd (PEq _ l r) = bracket p 2 $ se 10 bnd l ++ perhapsColourise colouriseType " = " ++ se 10 bnd r
1182 se p bnd (PRewrite _ l r _) = bracket p 2 $ "rewrite " ++ se 10 bnd l ++ " in " ++ se 10 bnd r
1183 se p bnd (PTyped l r) = "(" ++ se 10 bnd l ++ " : " ++ se 10 bnd r ++ ")"
1184 se p bnd (PPair _ l r) = "(" ++ se 10 bnd l ++ ", " ++ se 10 bnd r ++ ")"
1185 se p bnd (PDPair _ l t r) = "(" ++ se 10 bnd l ++ " ** " ++ se 10 bnd r ++ ")"
1186 se p bnd (PAlternative a as) = "(|" ++ showSep " , " (map (se 10 bnd) as) ++ "|)"
1187 se p bnd PType = perhapsColourise colouriseType "Type"
1188 se p bnd (PConstant c) = perhapsColourise (cfun c) (show c)
1189 where cfun (AType _) = colouriseType
1190 cfun StrType = colouriseType
1191 cfun PtrType = colouriseType
1192 cfun VoidType = colouriseType
1193 cfun _ = colouriseData
1194 se p bnd (PProof ts) = "proof { " ++ show ts ++ "}"
1195 se p bnd (PTactics ts) = "tactics { " ++ show ts ++ "}"
1196 se p bnd (PMetavar n) = "?" ++ show n
1197 se p bnd (PReturn f) = "return"
1198 se p bnd PImpossible = "impossible"
1199 se p bnd Placeholder = "_"
1200 se p bnd (PDoBlock _) = "do block show not implemented"
1201 se p bnd (PElabError s) = show s
1202 se p bnd (PCoerced t) = se p bnd t
1203 se p bnd (PUnifyLog t) = "%unifyLog " ++ se p bnd t
1204 se p bnd (PNoImplicits t) = "%noimplicit " ++ se p bnd t
1205-- se p bnd x = "Not implemented"
1207 slist' p bnd (PApp _ (PRef _ nil) _)
1208 | nsroot nil == UN "Nil" = Just []
1209 slist' p bnd (PApp _ (PRef _ cons) args)
1210 | nsroot cons == UN "::",
1211 (PExp {getTm=tl}):(PExp {getTm=hd}):imps <- reverse args,
1213 Just tl' <- slist' p bnd tl
1216 isImp (PImp {}) = True
1218 slist' _ _ _ = Nothing
1220 slist p bnd e | Just es <- slist' p bnd e = Just $
1221 case es of [] -> "[]"
1222 [x] -> "[" ++ se p bnd x ++ "]"
1223 xs -> "[" ++ intercalate "," (map (se p bnd ) xs) ++ "]"
1224 slist _ _ _ = Nothing
1226 -- since Prelude is always imported, S & Z are unqualified iff they're the
1229 | show o == (natns++"Z") || show o == "Z" = Just 0
1230 snat p (PApp _ s [PExp {getTm=n}])
1231 | show s == (natns++"S") || show s == "S",
1236 natns = "Prelude.Nat."
1238 sArg bnd (PImp _ _ _ n tm _) = siArg bnd (n, tm)
1239 sArg bnd (PExp _ _ tm _) = seArg bnd tm
1240 sArg bnd (PConstraint _ _ tm _) = scArg bnd tm
1241 sArg bnd (PTacImplicit _ _ n _ tm _) = stiArg bnd (n, tm)
1243 -- show argument, implicits given by the user also shown
1244 suiArg impl bnd (PImp _ mi _ n tm _)
1245 | impl || not mi = siArg bnd (n, tm)
1246 suiArg impl bnd (PExp _ _ tm _) = seArg bnd tm
1247 suiArg impl bnd _ = ""
1249 seArg bnd arg = " " ++ se 0 bnd arg
1250 siArg bnd (n, val) =
1252 val' = se 10 bnd val in
1254 then " {" ++ n' ++ "}"
1255 else " {" ++ n' ++ " = " ++ val' ++ "}"
1256 scArg bnd val = " {{" ++ se 10 bnd val ++ "}}"
1257 stiArg bnd (n, val) = " {auto " ++ show n ++ " = " ++ se 10 bnd val ++ "}"
1259 bracket outer inner str | inner > outer = "(" ++ str ++ ")"
1263instance Sized PTerm where
1264 size (PQuote rawTerm) = size rawTerm
1265 size (PRef fc name) = size name
1266 size (PLam name ty bdy) = 1 + size ty + size bdy
1267 size (PPi plicity name ty bdy) = 1 + size ty + size bdy
1268 size (PLet name ty def bdy) = 1 + size ty + size def + size bdy
1269 size (PTyped trm ty) = 1 + size trm + size ty
1270 size (PApp fc name args) = 1 + size args
1271 size (PAppBind fc name args) = 1 + size args
1272 size (PCase fc trm bdy) = 1 + size trm + size bdy
1274 size (PFalse fc) = 1
1275 size (PRefl fc _) = 1
1276 size (PResolveTC fc) = 1
1277 size (PEq fc left right) = 1 + size left + size right
1278 size (PRewrite fc left right _) = 1 + size left + size right
1279 size (PPair fc left right) = 1 + size left + size right
1280 size (PDPair fs left ty right) = 1 + size left + size ty + size right
1281 size (PAlternative a alts) = 1 + size alts
1282 size (PHidden hidden) = size hidden
1283 size (PUnifyLog tm) = size tm
1284 size (PNoImplicits tm) = size tm
1286 size (PConstant const) = 1 + size const
1287 size Placeholder = 1
1288 size (PDoBlock dos) = 1 + size dos
1289 size (PIdiom fc term) = 1 + size term
1290 size (PReturn fc) = 1
1291 size (PMetavar name) = 1
1292 size (PProof tactics) = size tactics
1293 size (PElabError err) = size err
1294 size PImpossible = 1
1296getPArity :: PTerm -> Int
1297getPArity (PPi _ _ _ sc) = 1 + getPArity sc
1300-- Return all names, free or globally bound, in the given term.
1302allNamesIn :: PTerm -> [Name]
1303allNamesIn tm = nub $ ni [] tm
1306 | not (n `elem` env) = [n]
1307 ni env (PApp _ f as) = ni env f ++ concatMap (ni env) (map getTm as)
1308 ni env (PAppBind _ f as) = ni env f ++ concatMap (ni env) (map getTm as)
1309 ni env (PCase _ c os) = ni env c ++ concatMap (ni env) (map snd os)
1310 ni env (PLam n ty sc) = ni env ty ++ ni (n:env) sc
1311 ni env (PPi _ n ty sc) = ni env ty ++ ni (n:env) sc
1312 ni env (PHidden tm) = ni env tm
1313 ni env (PEq _ l r) = ni env l ++ ni env r
1314 ni env (PRewrite _ l r _) = ni env l ++ ni env r
1315 ni env (PTyped l r) = ni env l ++ ni env r
1316 ni env (PPair _ l r) = ni env l ++ ni env r
1317 ni env (PDPair _ (PRef _ n) t r) = ni env t ++ ni (n:env) r
1318 ni env (PDPair _ l t r) = ni env l ++ ni env t ++ ni env r
1319 ni env (PAlternative a ls) = concatMap (ni env) ls
1320 ni env (PUnifyLog tm) = ni env tm
1321 ni env (PNoImplicits tm) = ni env tm
1324-- Return names which are free in the given term.
1326namesIn :: [(Name, PTerm)] -> IState -> PTerm -> [Name]
1327namesIn uvars ist tm = nub $ ni [] tm
1330 | not (n `elem` env)
1331 = case lookupTy n (tt_ctxt ist) of
1333 _ -> if n `elem` (map fst uvars) then [n] else []
1334 ni env (PApp _ f as) = ni env f ++ concatMap (ni env) (map getTm as)
1335 ni env (PAppBind _ f as) = ni env f ++ concatMap (ni env) (map getTm as)
1336 ni env (PCase _ c os) = ni env c ++ concatMap (ni env) (map snd os)
1337 ni env (PLam n ty sc) = ni env ty ++ ni (n:env) sc
1338 ni env (PPi _ n ty sc) = ni env ty ++ ni (n:env) sc
1339 ni env (PEq _ l r) = ni env l ++ ni env r
1340 ni env (PRewrite _ l r _) = ni env l ++ ni env r
1341 ni env (PTyped l r) = ni env l ++ ni env r
1342 ni env (PPair _ l r) = ni env l ++ ni env r
1343 ni env (PDPair _ (PRef _ n) t r) = ni env t ++ ni (n:env) r
1344 ni env (PDPair _ l t r) = ni env l ++ ni env t ++ ni env r
1345 ni env (PAlternative a as) = concatMap (ni env) as
1346 ni env (PHidden tm) = ni env tm
1347 ni env (PUnifyLog tm) = ni env tm
1348 ni env (PNoImplicits tm) = ni env tm
1351-- Return which of the given names are used in the given term.
1353usedNamesIn :: [Name] -> IState -> PTerm -> [Name]
1354usedNamesIn vars ist tm = nub $ ni [] tm
1357 | n `elem` vars && not (n `elem` env)
1358 = case lookupTy n (tt_ctxt ist) of
1361 ni env (PApp _ f as) = ni env f ++ concatMap (ni env) (map getTm as)
1362 ni env (PAppBind _ f as) = ni env f ++ concatMap (ni env) (map getTm as)
1363 ni env (PCase _ c os) = ni env c ++ concatMap (ni env) (map snd os)
1364 ni env (PLam n ty sc) = ni env ty ++ ni (n:env) sc
1365 ni env (PPi _ n ty sc) = ni env ty ++ ni (n:env) sc
1366 ni env (PEq _ l r) = ni env l ++ ni env r
1367 ni env (PRewrite _ l r _) = ni env l ++ ni env r
1368 ni env (PTyped l r) = ni env l ++ ni env r
1369 ni env (PPair _ l r) = ni env l ++ ni env r
1370 ni env (PDPair _ (PRef _ n) t r) = ni env t ++ ni (n:env) r
1371 ni env (PDPair _ l t r) = ni env l ++ ni env t ++ ni env r
1372 ni env (PAlternative a as) = concatMap (ni env) as
1373 ni env (PHidden tm) = ni env tm
1374 ni env (PUnifyLog tm) = ni env tm
1375 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