on 4e69658 help sign in
58 lines 3.3 kB history raw
1{-|
2Module : Idris.Help
3Description : Utilities to aid with the REPL's HELP system.
4Copyright :
5License : BSD3
6Maintainer : The Idris Community.
7-}
9module Idris.Help (CmdArg(..), extraHelp) where
11data CmdArg = ExprArg -- ^ The command takes an expression
12 | NameArg -- ^ The command takes a name
13 | FileArg -- ^ The command takes a file
14 | ModuleArg -- ^ The command takes a module name
15 | PkgArgs -- ^ The command takes a list of package names
16 | NumberArg -- ^ The command takes a number
17 | NamespaceArg -- ^ The command takes a namespace name
18 | OptionArg -- ^ The command takes an option
19 | MetaVarArg -- ^ The command takes a metavariable
20 | ColourArg -- ^ The command is the colour-setting command
21 | NoArg -- ^ No completion (yet!?)
22 | SpecialHeaderArg -- ^ do not use
23 | ConsoleWidthArg -- ^ The width of the console
24 | DeclArg -- ^ An Idris declaration, as might be contained in a file
25 | ManyArgs CmdArg -- ^ Zero or more of one kind of argument
26 | OptionalArg CmdArg -- ^ Zero or one of one kind of argument
27 | SeqArgs CmdArg CmdArg -- ^ One kind of argument followed by another
29instance Show CmdArg where
30 show ExprArg = "<expr>"
31 show NameArg = "<name>"
32 show FileArg = "<filename>"
33 show ModuleArg = "<module>"
34 show PkgArgs = "<package list>"
35 show NumberArg = "<number>"
36 show NamespaceArg = "<namespace>"
37 show OptionArg = "<option>"
38 show MetaVarArg = "<hole>"
39 show ColourArg = "<option>"
40 show NoArg = ""
41 show SpecialHeaderArg = "Arguments"
42 show ConsoleWidthArg = "auto|infinite|<number>"
43 show DeclArg = "<top-level declaration>"
44 show (ManyArgs a) = "(" ++ show a ++ ")..."
45 show (OptionalArg a) = "[" ++ show a ++ "]"
46 show (SeqArgs a b) = show a ++ " " ++ show b
48-- | Use these for completion, but don't show them in :help
49extraHelp ::[([String], CmdArg, String)]
50extraHelp =
51 [ ([":casesplit!", ":cs!"], NoArg, ":cs! <line> <name> destructively splits the pattern variable on the line")
52 , ([":addclause!", ":ac!"], NoArg, ":ac! <line> <name> destructively adds a clause for the definition of the name on the line")
53 , ([":addmissing!", ":am!"], NoArg, ":am! <line> <name> destructively adds all missing pattern matches for the name on the line")
54 , ([":makewith!", ":mw!"], NoArg, ":mw! <line> <name> destructively adds a with clause for the definition of the name on the line")
55 , ([":proofsearch!", ":ps!"], NoArg, ":ps! <line> <name> <names> destructively does proof search for name on line, with names as hints")
56 , ([":addproofclause!", ":apc!"], NoArg, ":apc! <line> <name> destructively adds a pattern-matching proof clause to name on line")
57 , ([":refine!", ":ref!"], NoArg, ":ref! <line> <name> <name'> destructively attempts to partially solve name on line, with name' as hint, introducing holes for arguments that aren't inferrable")
58 ]