fsharp / fsharp/fslang-suggestions
More repl features (search for type, browse module, show docs, print function definition, etc.)
- Dominant language
- No language data
- Stars
- 373
- Forks
- 21
- PR merge metrics
- No merged PRs in 30d
Description
# More repl features
I propose we give fsharp-interactive some love by adding some more features to it.
In particular, I would love to be able to list all functions in a namespace/module, print function definitions, print docs and search for functions by type.
For reference this is what you can do in the Idris repl:
```
Idris> :?
Idris version 1.0
-----------------
Command Arguments Purpose
Evaluate an expression
:t :type Check the type of an expression
:core View the core language representation of a term
:miss :missing Show missing clauses
:doc Show internal documentation
:mkdoc Generate IdrisDoc for namespace(s) and dependencies
:apropos [] Search names, types, and documentation
:s :search [] Search for values by type
:wc :whocalls List the callers of some name
:cw :callswho List the callees of some name
:browse List the contents of some namespace
:total Check the totality of a name
:r :reload Reload current file
:w :watch Watch the current file for changes
:l :load Load a new file
:! Run a shell command
:cd Change working directory
:module Import an extra module
:e :edit Edit current file using $EDITOR or $VISUAL
:m :metavars Show remaining proof obligations (metavariables or holes)
:p :prove Prove a metavariable
:elab Build a metavariable using the elaboration shell
:a :addproof Add proof to source file
:rmproof Remove proof from proof stack
:showproof Show proof
:proofs Show available proofs
:x Execute IO actions resulting from an expression using the interpreter
:c :compile Compile to an executable [codegen]
:exec :execute [] Compile to an executable and run
:dynamic Dynamically load a C library (similar to %dynamic)
:dynamic List dynamically loaded C libraries
:? :h :help Display this help text
:set Set an option (errorcontext, showimplicits, originalerrors, autosolve, nobanner, warnreach, evaltypes, desugarnats)
:unset Unset an option
:color :colour Turn REPL colours on or off; set a specific colour
:consolewidth auto|infinite|Set the width of the console
:printerdepth [] Set the maximum pretty-printer depth (no arg for infinite)
:q :quit Exit the Idris system
:warranty Displays warranty information
:let ()...Evaluate a declaration, such as a function definition, instance implementation, or fixity declaration
:unlet :undefine()... Remove the listed repl definitions, or all repl definitions if no names given
:printdef Show the definition of a function
:pp :pprint Pretty prints an Idris function in either LaTeX or HTML and for a specified width.
:verbosity Set verbosity level
```
Searching by type:
```
Idris> :s List (Maybe a) -> Maybe (List a)
< Prelude.Traversable.sequence : Traversable t => Applicative f => t (f a) -> f (t a)
Evaluate each computation in a structure and collect the results
```
Printing functions definitions:
```
Idris> :printdef Prelude.Traversable.sequence
sequence : Traversable t => Applicative f => t (f a) -> f (t a)
sequence = traverse id
```
Printing docs:
```
Idris> :doc Prelude.Traversable.sequence
Prelude.Traversable.sequence : Traversable t => Applicative f => t (f a) -> f (t a)
Evaluate each computation in a structure and collect the results
The function is Total
```
Browse a namespace:
```
Idris> :browse Prelude.Traversable
Namespaces:
Names:
Traversable : (Type -> Type) -> Type
for : Traversable t => Applicative f => t a -> (a -> f b) -> f (t b)
for_ : Foldable t => Applicative f => t a -> (a -> f b) -> f ()
sequence : Traversable t => Applicative f => t (f a) -> f (t a)
sequence_ : Foldable t => Applicative f => t (f a) -> f ()
traverse : Traversable t => Applicative f => (a -> f b) -> t a -> f (t b)
traverse_ : Foldable t => Applicative f => (a -> f b) -> t a -> f ()
```
## Pros and Cons
I think this would greatly improve the developer-user-experience across all platforms.
Contributor guide
No contributing guide indexed for this repository
Research direction
Begin with the fsharp-interactive REPL and the Idris command examples included in the issue. Break the proposal into type search, namespace browsing, documentation display, and definition printing, then define the commands and expected output for each; the issue names no files or tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- fsharp
- Domain
- cli, developer-experience
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100