on 02de034 help sign in
91 lines 5.8 kB history raw
1module Idris.Help (CmdArg(..), help, extraHelp) where
3data CmdArg = ExprArg -- ^ The command takes an expression
4 | NameArg -- ^ The command takes a name
5 | FileArg -- ^ The command takes a file
6 | ModuleArg -- ^ The command takes a module name
7 | NamespaceArg -- ^ The command takes a namespace name
8 | OptionArg -- ^ The command takes an option
9 | MetaVarArg -- ^ The command takes a metavariable
10 | ColourArg -- ^ The command is the colour-setting command
11 | NoArg -- ^ No completion (yet!?)
12 | SpecialHeaderArg -- ^ do not use
13 | ConsoleWidthArg -- ^ The width of the console
14 | DeclArg -- ^ An Idris declaration, as might be contained in a file
15 | ManyArgs CmdArg -- ^ Zero or more of one kind of argument
16 | OptionalArg CmdArg -- ^ Zero or one of one kind of argument
17 | SeqArgs CmdArg CmdArg -- ^ One kind of argument followed by another
19instance Show CmdArg where
20 show ExprArg = "<expr>"
21 show NameArg = "<name>"
22 show FileArg = "<filename>"
23 show ModuleArg = "<module>"
24 show NamespaceArg = "<namespace>"
25 show OptionArg = "<option>"
26 show MetaVarArg = "<metavar>"
27 show ColourArg = "<option>"
28 show NoArg = ""
29 show SpecialHeaderArg = "Arguments"
30 show ConsoleWidthArg = "auto|infinite|<number>"
31 show DeclArg = "<top-level declaration>"
32 show (ManyArgs a) = "(" ++ show a ++ ")..."
33 show (OptionalArg a) = "[" ++ show a ++ "]"
34 show (SeqArgs a b) = show a ++ " " ++ show b
36help :: [([String], CmdArg, String)]
37help =
38 [ (["<expr>"], NoArg, "Evaluate an expression"),
39 ([":t"], ExprArg, "Check the type of an expression"),
40 ([":miss", ":missing"], NameArg, "Show missing clauses"),
41 ([":doc"], NameArg, "Show internal documentation"),
42 ([":mkdoc"], NamespaceArg, "Generate IdrisDoc for namespace(s) and dependencies"),
43 ([":apropos"], NoArg, "Search names, types, and documentation"),
44 ([":search", ":s"], ExprArg, "Search for values by type"),
45 ([":whocalls", ":wc"], NameArg, "List the callers of some name"),
46 ([":callswho", ":cw"], NameArg, "List the callees of some name"),
47 ([":total"], NameArg, "Check the totality of a name"),
48 ([":r",":reload"], NoArg, "Reload current file"),
49 ([":l",":load"], FileArg, "Load a new file"),
50 ([":cd"], FileArg, "Change working directory"),
51 ([":module"], ModuleArg, "Import an extra module"), -- NOTE: dragons
52 ([":e",":edit"], NoArg, "Edit current file using $EDITOR or $VISUAL"),
53 ([":m",":metavars"], NoArg, "Show remaining proof obligations (metavariables)"),
54 ([":p",":prove"], MetaVarArg, "Prove a metavariable"),
55 ([":a",":addproof"], NameArg, "Add proof to source file"),
56 ([":rmproof"], NameArg, "Remove proof from proof stack"),
57 ([":showproof"], NameArg, "Show proof"),
58 ([":proofs"], NoArg, "Show available proofs"),
59 ([":x"], ExprArg, "Execute IO actions resulting from an expression using the interpreter"),
60 ([":c",":compile"], FileArg, "Compile to an executable [codegen] <filename>"),
61 ([":exec",":execute"], NoArg, "Compile to an executable and run"),
62 ([":dynamic"], FileArg, "Dynamically load a C library (similar to %dynamic)"),
63 ([":dynamic"], NoArg, "List dynamically loaded C libraries"),
64 ([":?",":h",":help"], NoArg, "Display this help text"),
65 ([":set"], OptionArg, "Set an option (errorcontext, showimplicits)"),
66 ([":unset"], OptionArg, "Unset an option"),
67 ([":colour", ":color"], ColourArg, "Turn REPL colours on or off; set a specific colour"),
68 ([":consolewidth"], ConsoleWidthArg, "Set the width of the console"),
69 ([":q",":quit"], NoArg, "Exit the Idris system"),
70 ([":w", ":warranty"], NoArg, "Displays warranty information"),
71 ([":let"], ManyArgs DeclArg, "Evaluate a declaration, such as a function definition, instance implementation, or fixity declaration"),
72 ([":undefine",":unlet"], ManyArgs NameArg, "Remove the listed repl definitions, or all repl definitions if no names given"),
73 ([":printdef"], NameArg, "Show the definition of a function")
74 ]
76-- | Use these for completion, but don't show them in :help
77extraHelp ::[([String], CmdArg, String)]
78extraHelp =
79 [ ([":casesplit", ":cs"], NoArg, ":cs <line> <name> splits the pattern variable on the line")
80 , ([":casesplit!", ":cs!"], NoArg, ":cs! <line> <name> destructively splits the pattern variable on the line")
81 , ([":addclause", ":ac"], NoArg, ":ac <line> <name> adds a clause for the definition of the name on the line")
82 , ([":addclause!", ":ac!"], NoArg, ":ac! <line> <name> destructively adds a clause for the definition of the name on the line")
83 , ([":addmissing", ":am"], NoArg, ":am <line> <name> adds all missing pattern matches for the name on the line")
84 , ([":addmissing!", ":am!"], NoArg, ":am! <line> <name> destructively adds all missing pattern matches for the name on the line")
85 , ([":makewith", ":mw"], NoArg, ":mw <line> <name> adds a with clause for the definition of the name on the line")
86 , ([":makewith!", ":mw!"], NoArg, ":mw! <line> <name> destructively adds a with clause for the definition of the name on the line")
87 , ([":proofsearch", ":ps"], NoArg, ":ps <line> <name> <names> does proof search for name on line, with names as hints")
88 , ([":proofsearch!", ":ps!"], NoArg, ":ps! <line> <name> <names> destructively does proof search for name on line, with names as hints")
89 , ([":addproofclause", ":apc"], NoArg, ":apc <line> <name> adds a pattern-matching proof clause to name on line")
90 , ([":addproofclause!", ":apc!"], NoArg, ":apc! <line> <name> destructively adds a pattern-matching proof clause to name on line")
91 ]