git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Better psci help
c95d99cHarry Garrood
psci/Directive.hs+4−4
@@ -102,12 +102,12 @@ help :: [(Directive, String, String)]
102help =
102help =
103 [ (Help, "", "Show this help menu")
103 [ (Help, "", "Show this help menu")
104 , (Quit, "", "Quit PSCi")
104 , (Quit, "", "Quit PSCi")
105− , (Reset, "", "Reset")
105+ , (Reset, "", "Discard all imported modules and declared bindings")
106− , (Browse, "<module>", "Browse <module>")
106+ , (Browse, "<module>", "See all functions in <module>")
107 , (Load, "<file>", "Load <file> for importing")
107 , (Load, "<file>", "Load <file> for importing")
108 , (Type, "<expr>", "Show the type of <expr>")
108 , (Type, "<expr>", "Show the type of <expr>")
109 , (Kind, "<type>", "Show the kind of <type>")
109 , (Kind, "<type>", "Show the kind of <type>")
110− , (Show, "import", "Show imported modules")
110+ , (Show, "import", "Show all imported modules")
111− , (Show, "loaded", "Show loaded modules")
111+ , (Show, "loaded", "Show all loaded modules")
112 ]
112 ]
113
113
psci/PSCi.hs+29−10
@@ -124,17 +124,36 @@ expandTilde p = return p
124--
124--
125helpMessage :: String
125helpMessage :: String
126helpMessage = "The following commands are available:\n\n " ++
126helpMessage = "The following commands are available:\n\n " ++
127− intercalate "\n " (map line D.help)
127+ intercalate "\n " (map line D.help) ++
128+ "\n\n" ++ extraHelp
128 where
129 where
129− line :: (Directive, String, String) -> String
130+ line :: (Directive, String, String) -> String
130− line (dir, arg, desc) = intercalate " "
131+ line (dir, arg, desc) =
131− [ cmd
132− , replicate (11 - length cmd) ' '
133− , arg
134− , replicate (11 - length arg) ' '
135− , desc
136− ]
137− where cmd = ":" ++ D.stringFor dir
132+ let cmd = ':' : D.stringFor dir
133+ in intercalate " "
134+ [ cmd
135+ , replicate (11 - length cmd) ' '
136+ , arg
137+ , replicate (11 - length arg) ' '
138+ , desc
139+ ]
140+
141+ extraHelp = unlines
142+ [ "Once a file has been loaded, values and types in the module(s) that it"
143+ , "contains are available fully qualified:"
144+ , ""
145+ , " > :type Data.Function.on"
146+ , " forall a b c. (b -> b -> c) -> (a -> b) -> a -> a -> c"
147+ , ""
148+ , "Alternatively, you can import a loaded module in order to bring types and"
149+ , "values into the current scope - then, you can use them unqualified."
150+ , ""
151+ , "Modules can be imported normally, as in PureScript code, eg:"
152+ , ""
153+ , " > import Control.Monad"
154+ , " > import Prelude.Unsafe (unsafeIndex)"
155+ , " > import qualified Data.List as L"
156+ ]
138
157
139-- |
158-- |
140-- The welcome prologue.
159-- The welcome prologue.