Skip to content

Instantly share code, notes, and snippets.

@DanielG
Created September 14, 2014 02:58
Show Gist options
  • Select an option

  • Save DanielG/dfb227d8909c021422c1 to your computer and use it in GitHub Desktop.

Select an option

Save DanielG/dfb227d8909c021422c1 to your computer and use it in GitHub Desktop.
Usage: ghc-mod [OPTIONS...] COMMAND [OPTIONS...]
*Global Options (OPTIONS)*
Global options can be specified before and after the command and
interspersed with command specific options
-v, --verbose
Be more verbose.
-l, --tolisp
Format output as an S-Expression
-b SEP, --boundary=SEP
Output line separator
-g OPT, --ghcOpt=OPT
Options to be passed to GHC
--with-ghc=PROG
GHC executable to use
--with-cabal=PROG
cabal-install executable to use
*Commands*
- version
Print the version of the program.
- help
Print this help message.
- list [FLAGS...]
List all visible modules.
Flags:
-d
Also print the module's package.
- lang
List all known GHC language extensions.
- flag
List GHC -f<bla> flags.
- browse [FLAGS...] [PACKAGE:]MODULE...
List symbols in a module.
Flags:
-o
Also print operators.
-d
Print symbols with accompanying signatures.
-q
Qualify symbols.
- check FILE...
Load the given files using GHC and report errors/warnings, but
don't produce output files.
- expand FILE...
Like `check' but also pass `-ddump-splices' to GHC.
- info FILE [MODULE] EXPR
Lookup an identifier in the context of FILE (like ghci's `:info')
MODULE is completely ignored and only allowed for backwards
compatibility.
- type FILE [MODULE] LINE COL
Get the type of the expression under (LINE,COL).
- split FILE MODULE LINE COL
Split a function case by examining a type's constructors.
For example given the following code snippet:
f :: [a] -> a
f x = _body
would be replaced by:
f :: [a] -> a
f [] = _body
f (x:xs) = _body
(See https://github.com/kazu-yamamoto/ghc-mod/pull/274)
- sig FILE MODULE LINE COL
Generate initial code given a signature.
For example when (LINE,COL) is on the signature in the following
code snippet:
func :: [a] -> Maybe b -> (a -> b) -> (a,b)
ghc-mod would add the following on the next line:
func x y z f = _func_body
(See: https://github.com/kazu-yamamoto/ghc-mod/pull/274)
- refine FILE MODULE LINE COL EXPR
Refine the typed hole at (LINE,COL) given EXPR.
For example if EXPR is `filter', which has type `(a -> Bool) -> [a]
-> [a]' and (LINE,COL) is on the hole `_body' in the following
code snippet:
filterNothing :: [Maybe a] -> [a]
filterNothing xs = _body
ghc-mod changes the code to get a value of type `[a]', which
results in:
filterNothing xs = filter _body_1 _body_2
(See also: https://github.com/kazu-yamamoto/ghc-mod/issues/311)
- auto FILE MODULE LINE COL
Try to automatically fill the contents of a hole.
- find SYMBOL
List all modules that define SYMBOL.
- lint FILE
Check files using `hlint'.
Flags:
-l
Options to be passed to hlint.
- root FILE
Try to finds the project directory given FILE. For Cabal
projects this is the directory containing the cabal file, for
projects that use a cabal sandbox but have no cabal file this is the
directory containing the sandbox and otherwise this is the directory
containing FILE.
- doc MODULE
Try finding the html documentation directory for the given MODULE.
- debug
Print debugging information. Please include the output in any bug
reports you submit.
- boot
Internal command used by the emacs frontend.
The following forms are supported so ghc-mod can be invoked by
`cabal repl':
ghc-mod OPTIONS --make GHC_OPTIONS
Pass through all options `ghc' executable.
ghc-mod OPTIONS --interactive GHC_OPTIONS [--ghc-mod]
Start ghci emulation mode. GHC_OPTIONS are passed to the
GHC API. If `--ghc-mod' is given ghc-mod specific extensions
are enabled.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment