My personal dotfiles
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

_ghc 32KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618
  1. #compdef ghc ghci ghc-pkg
  2. # ------------------------------------------------------------------------------
  3. # Copyright (c) 2014 Github zsh-users - http://github.com/zsh-users
  4. # All rights reserved.
  5. #
  6. # Redistribution and use in source and binary forms, with or without
  7. # modification, are permitted provided that the following conditions are met:
  8. # * Redistributions of source code must retain the above copyright
  9. # notice, this list of conditions and the following disclaimer.
  10. # * Redistributions in binary form must reproduce the above copyright
  11. # notice, this list of conditions and the following disclaimer in the
  12. # documentation and/or other materials provided with the distribution.
  13. # * Neither the name of the zsh-users nor the
  14. # names of its contributors may be used to endorse or promote products
  15. # derived from this software without specific prior written permission.
  16. #
  17. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  18. # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  19. # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  20. # DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY
  21. # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  22. # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  23. # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  24. # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  25. # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  26. # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27. # ------------------------------------------------------------------------------
  28. # Description
  29. # -----------
  30. #
  31. # Completion script for ghc (http://www.haskell.org/ghc/)
  32. #
  33. # ------------------------------------------------------------------------------
  34. # Authors
  35. # -------
  36. #
  37. # * Gérard Milmeister
  38. # * Philip Dexter <philip.dexter@gmail.com>
  39. #
  40. # ------------------------------------------------------------------------------
  41. local state
  42. local WORDS
  43. #
  44. # ghci
  45. #
  46. _ghc_ghci () { _ghc_compiler }
  47. #
  48. # ghc
  49. #
  50. _ghc_compiler ()
  51. {
  52. _arguments \
  53. "-no-hs-main[Don't assume this program contains main]" \
  54. "-no-user-package-conf[Don't load the user's package config file]" \
  55. '(- *)'{--help,-\?}'[Show help information]' \
  56. '*-I-[Add directory to path for #include files]:directory:_files -/' \
  57. '*-X-[Language flags]:flag:_ghc_language_flags' \
  58. '*-d-[Debugging options]:flag:_ghc_debugging_options' \
  59. '*-f-[Compiler options]:flag:_ghc_compiler_flags' \
  60. '*-hide-package[Hide package]:Package:_ghc_pkg_list_packages' \
  61. '*-trust[Expose package and set it to be trusted]:Package:_ghc_pkg_list_packages' \
  62. '*-distrust[Expose package and set it to be distrusted]:Package:_ghc_pkg_list_packages' \
  63. '*-distrust-all[Distrust all packages by default]' \
  64. '*-i-[Add directory to import path]:directory:->ghc_include_directory' \
  65. '*-package[Expose package]:Package:_ghc_pkg_list_packages' \
  66. '*:file:_files -g \*.\{lhs,hs,hc,c,s\}' \
  67. '--info[Display information about the compiler]' \
  68. '--show-options[Display the supported command line options]' \
  69. '--interactive[Interactive mode]' \
  70. '--make[Compile and link a complete Haskell program]:file:_files -g "*.{lhs,hs,hc,c,s}"' \
  71. '--numeric-version[Display GHC version (numeric only)]' \
  72. '--print-libdir[Display GHC library directory]' \
  73. '--show-iface[Show interface]:file:_files -g "*.hi"' \
  74. {--supported-languages,--supported-extensions}'[Display the supported language extensions]' \
  75. '-C[Stop after generating C]' \
  76. '-E[Stop after generating preprocessed, de-litted Haskell]' \
  77. '-H[Minimum heap size]:size:' \
  78. '-M[Output Makefile rules]' \
  79. '-O-[Enable optimization]:level:(0 1 2)' \
  80. '-Rghc-timing[Summarise timing stats for GHC]' \
  81. '-S[Stop after generating assembler]' \
  82. '-V[Display GHC version]' \
  83. '-W[Enable normal warnings]' \
  84. '-Wall[Enable almost all warnings]' \
  85. '-Werror[Make warnings fatal]' \
  86. '-Wwarn[Make warnings non-fatal]' \
  87. '-c[Stop after generating object files]' \
  88. '-eventlog[Enable runtime event tracing]' \
  89. '-debug[Use the debugging runtime]' \
  90. "-dylib-install-name[On Darwin/OS X only, set the install name]" \
  91. '-dynamic[Use dynamic Haskell libraries]' \
  92. '-dynamic-too[Build dynamic object files as well as static object files during compilation]' \
  93. '-dynosuf[Set the output suffix for dynamic object files]' \
  94. '-dynload[Select one of a number of modes for finding shared libraries at runtime]' \
  95. '--mk-dll[DLL-creation mode (Windows only)]' \
  96. '-framework-path[On Darwin/OS X/iOS only, add dir to the list of directories searched for frameworks]' \
  97. '-shared[Generate a shared library (as opposed to an executable)]' \
  98. '-staticlib[On Darwin/OS X/iOS only, generate a standalone static library (as opposed to an executable)]' \
  99. '-e[Evaluate expression]' \
  100. '-hide-all-packages[Hide all packages by default]' \
  101. '-hpcdir[Directory to deposit .mix files during compilation (default is .hpc)]' \
  102. '-n[Do a dry run]' \
  103. '-o[Set output filename]:file:_files' \
  104. '-outputdir[Set output directory]:directory:_files -/' \
  105. '-package-name[Compile to be part of package]' \
  106. '-hide-all-packages[Hide all packages by default]' \
  107. '-package-db[Add file to the package db stack]:file:_files' \
  108. '-clear-package-db[Clear the package db stack]' \
  109. '-msse2[(x86 only) Use SSE2 for floating point]' \
  110. '-monly-\[432\]-regs[(x86 only) give some registers back to the C compiler]' \
  111. '-no-global-package-db[Remove the global package db from the stack]' \
  112. '-global-package-db[Add the global package db to the stack]' \
  113. "-no-user-package-db[Remove the user's package db from the stack]" \
  114. "-user-package-db[Add the user's package db to the stack]" \
  115. "-no-auto-link-packages[Don't automatically link in the base and rts packages]" \
  116. '-optL[pass option to the literate pre-processor]' \
  117. '-optP[pass option to cpp (with -cpp only)]' \
  118. '-optF[pass option to the custom pre-processor]' \
  119. '-optc[pass option to the C compiler]' \
  120. '-optlo[pass option to the LLVM optimiser]' \
  121. '-optlc[pass option to the LLVM compiler]' \
  122. '-optm[pass option to the mangler]' \
  123. '-opta[pass option to the assembler]' \
  124. '-optl[pass option to the linker]' \
  125. '-optdll[pass option to the DLL generator]' \
  126. '-optwindres[pass option to windres.]' \
  127. '-prof[Turn on profiling]' \
  128. '-pgmL[Use cmd as the literate pre-processor]' \
  129. '-pgmP[Use cmd as the C pre-processor (with -cpp only)]' \
  130. '-pgmc[Use cmd as the C compiler]' \
  131. '-pgms[Use cmd as the splitter]' \
  132. '-pgml[Use cmd as the linker]' \
  133. '-pgmdll[Use cmd as the DLL generator]' \
  134. '-pgmF[Use cmd as the pre-proecessor (with -F only)]' \
  135. '-pgmwindres[Use cmd as the program for embedding manifests on Windows]' \
  136. '-pgmlibtool[Use cmd as the command for libtool (with -staticlib only)]' \
  137. '-rtsopts[Only a minimum of safe options can be given to RTS]' \
  138. '-rtsopts=[Control whether the RTS behavior can be tweaked via command-line flags and the GHCRTS environment varaible (none, som, or all)]' \
  139. '-with-rtsopts=[Set the default RTS options]' \
  140. '-threaded[Use the threaded runtime]' \
  141. '-ticky[Turn on ticky-ticky profiling]' \
  142. '-tmpdir[Set the directory for temporary files]:directory:_files -/' \
  143. '-v-[Control verbosity]:level:(0 1 2 3 4 5)' \
  144. '-w[Disable all warnings]' \
  145. '-x[Override default behaviour for source files]:suffix:(hs lhs hc c s o hspp)' \
  146. '-hcsuf[Set the suffix to use for intermediate]:suffix:' \
  147. '-hidir[Set directory for interface files]:directory:_files -/' \
  148. '-hisuf[Set the suffix to use for interface files]:suffix:' \
  149. '-odir[Set directory for object files]:directory:_files -/' \
  150. '-ohi[Set the filename in which to put the interface]:filename:_files -/' \
  151. '-osuf[Set the output file suffix]:suffix:' \
  152. '-stubdir[Redirect FFi stub files]:directory:_files -/' \
  153. '-dumpdir[Redirect dump files]:directory:_files -/' \
  154. '-outputdir[Set output directory]:directory:_files -/' \
  155. '-keep-hc-files[Retain intermediate .hc files]' \
  156. '-keep-llvm-files[Retain intermediate LLVM .ll files]' \
  157. '-keep-s-files[Retain intermediate .s files]' \
  158. '-keep-raw-s-files[Retain intermediate .raw_s files]' \
  159. '-keep-tmp-files[Retain all intermediate temporary files]' \
  160. '-static[Use static Haskell libraries]' \
  161. '-split-objs[Split objects (for libraries)]' \
  162. '-no-link[Omit linking]' \
  163. '-main-is[Set main module and function]:function:' \
  164. '*-L-[Add dir to the list of directories searched for libraries]:directory:_files -/' \
  165. '*-l-[Link in library]:library:->library'
  166. [[ -n "$state" ]] &&
  167. case "$state" in
  168. ghc_include_directory) _ghc_include_directory ;;
  169. library)
  170. _wanted libraries expl library \
  171. compadd - \
  172. ${^=LD_LIBRARY_PATH:-/usr/lib /usr/local/lib}/lib*.(a|so*)(:t:fr:s/lib//) \
  173. && ret=0
  174. esac
  175. }
  176. _ghc_include_directory ()
  177. {
  178. compset -P '*:'
  179. compset -S ':*'
  180. _path_files -r': ' -/
  181. }
  182. _ghc_compiler_flags ()
  183. {
  184. local _ghc_compiler_flags_list
  185. _ghc_compiler_flags_list=(
  186. 'ghci-hist-size:Set the number of entries GHCi keeps for \:history'
  187. 'print-explicit-foralls:Print explicit forall quantification in types'
  188. 'print-explicit-kinds:Print explicit kind foralls and kind arguments in types'
  189. {no-,}'break-on-error:Break on uncaught exceptions and errors'
  190. {no-,}'break-on-exception:Break on any exception thrown'
  191. {no-,}'case-merge:Enable case-merging'
  192. {no-,}'defer-type-errors:Defer as many type errors as possible until runtime'
  193. {no-,}'dicts-strict:Make dictionaries strict'
  194. {no-,}'do-eta-reduction:Enable eta-reduction'
  195. {no-,}'do-lambda-eta-expansion:Enable lambda eta-reduction'
  196. 'eager-blackholing:Turn on eager blackholing'
  197. {no-,}'enable-rewrite-rules:Switch on all rewrite rules (including rules generated by automatic specialisation of overloaded functions)'
  198. 'error-spans:Output full span in error messages'
  199. 'ext-core:Generate .hcr external Core file'
  200. 'force-recomp:Turn off recompilation checking'
  201. {no-,}'float-in:Turn on the float-in transformation'
  202. {no-,}'full-laziness:Turn on full laziness (floating bindings outwards)'
  203. {no-,}'fun-to-thunk:Allow worker-wrapper to convert a function closure into a thunk if the function does not use any of its arguments. Off by default.'
  204. {no-,}'glasgow-exts:Enable most language extensions'
  205. {no-,}'helpful-errors:Make suggestions for mis-spelled names'
  206. 'history-size:Set simplification history size'
  207. {no-,}'ignore-asserts:Ignore assertions in the source'
  208. {no-,}'ignore-interface-pragmas:Ignore pragmas in interface files'
  209. {no-,}'loopification:Turn saturated self-recursive tail-calls into local jumps in the generated assembly'
  210. {no-,}'late-dmd-anal:Run demand analysis again, at the end of the simplification pipeline'
  211. {no-,}'liberate-case:Turn on the liberate-case transformation'
  212. 'liberate-case-threshold=:Set the size threshold for the liberate-case transformation (default 200)'
  213. 'no-liberate-case-threshold:Set the size threshold for the liberate-case transformation (default 200)'
  214. {no-,}'max-relevant-bindings=N:Set the maximum number of bindings to display in type error messages (default 6).'
  215. 'max-worker-args=:If a worker has that many arguments, none will be unpacked anymore (default 10)'
  216. 'max-simplifier-iterations=:Set the max iterations for the simplifier'
  217. 'no-asm-mangling:Turn off assembly mangling'
  218. 'no-black-holing:Turn off black holing'
  219. "no-hi-version-check:Don't complain about .hi file mismatches"
  220. 'no-implicit-import-qualified:Turn off implicit qualified import of everything in GHCi'
  221. 'no-print-bind-contents:Turn off printing of binding contents in GHCi'
  222. 'no-opt-coercion:Turn off the coercion optimiser'
  223. 'no-ghci-history:Do not use the load/store the GHCi command history from/to ghci_history'
  224. 'no-ghci-sandbox:Turn off the GHCi sandbox. Means computations are run in the main thread, rather than a forked thread'
  225. 'no-gen-manifest:Do not generate a manifest file (Windows only)'
  226. 'no-embed-manifest:Do not embed the manifest in the executable (Windows only)'
  227. "no-shared-implib:Don't generate an import library for a DLL (Windows only)"
  228. 'no-pre-inlining:Turn off pre-inlining'
  229. 'no-state-hack:Turn off the "state hack" whereby any lambda with a real-world state token as argument is considered to be single-entry'
  230. {no-,}'print-bind-result:Turn on printing of binding results in GHCi'
  231. {no-,}'print-evld-with-show:Enable usage of Show instances in \:print'
  232. 'unregisterised:Unregisterised compilation'
  233. 'asm:Use the native code generator'
  234. 'via-C:Compile via C'
  235. 'no-code:Omit code generation'
  236. 'byte-code:Generate byte-code'
  237. 'object-code:Generate object code'
  238. 'hpc:Turn on Haskell program coverage instrumentation'
  239. 'PIC:Generate position-independent code'
  240. 'plugin=:Load a plugin exported by a given module'
  241. 'plugin-opt=:Give arguments to a plugin module'
  242. 'context-stack=:Set the limit for context reduction (default is 20)'
  243. 'type-function-depth=:Set the limit for type function reductions (default is 200)'
  244. 'force-recomp:Turn off recompilation checking'
  245. {no-,}"omit-interface-pragmas:Don't generate interface pragmas"
  246. 'package-trust:Enable Safe Haskell trusted package requirement for trustworthy modules'
  247. {no-,}'pedantic-bottoms:Make GHC be more precise about its treatment of bottom'
  248. {no-,}'disambiguate-record-fields:Enable record field disambiguation'
  249. {no-,}'irrefutable-tuples:Make tuple pattern matching irrefutable'
  250. {no-,}'vectorise:Enable vectorisation of nested data parallelism'
  251. {no-,}'avoid-vect:Enable vectorisation avoidance'
  252. {no-,}'excess-precision:Enable excess intermediate precision'
  253. {no-,}'prof-auto:Auto-add SCCs to all bindings not marked INLINE'
  254. {no-,}'prof-auto-top:Auto-add SCCs to all top-level bindings not marked INLINE'
  255. {no-,}'prof-auto-exported:Auto-add SCCs to all exported bindings not marked INLINE'
  256. {no-,}'prof-cafs:Auto-add SCCs to all CAFs'
  257. {no-,}'prof-count-entries:Collect entry counts'
  258. 'simplifier-phases:Set the number of phases for the simplifier (default 2)'
  259. 'simpl-tick-factor=:Set the percentage factor for simplifier ticks (default 100)'
  260. {no-,}'spec-constr:Turn on the SpecConstr transformation'
  261. {no-,}'spec-constr-threshold=:Set the size threshold for the SpecConstr transformation (default 200)'
  262. {no-,}'spec-constr-count=:Set the maximum number of specialisations that will be created for any one function by the SpecConstr transformation (default 3)'
  263. 'strictness=before=:Run an additional strictness analysis before a simplifier phase'
  264. {no-,}'static-argument-transformation:Turn on the static argument transformation'
  265. {no-,}'unbox-strict-fields:Flatten strict constructor fields'
  266. {no-,}'unbox-small-strict-fields:Flatten strict constructor fields with a pointer-sized representation'
  267. {no-,}'unfolding-creation-threshold:Tweak unfolding settings'
  268. {no-,}'unfolding-fun-discount:Tweak unfolding settings'
  269. {no-,}'unfolding-keeness-factor:Tweak unfolding settings'
  270. {no-,}'unfolding-use-threshold:Tweak unfolding settings'
  271. {no-,}'warn-warnings-deprecations:Warn about uses of functions & types that have warnings or deprecated pragmas'
  272. {no-,}'warn-deprecated-flags:Warn about uses of commandline flags that are deprecated'
  273. {no-,}'warn-duplicate-exports:Warn when an entity is exported multiple times'
  274. {no-,}'warn-hi-shadowing:Warn when a .hi file in the current directory shadows a library'
  275. {no-,}'warn-implicit-prelude:Warn when the Prelude is implicitly imported'
  276. {no-,}'warn-incomplete-patterns:Warn when a pattern match could fail'
  277. {no-,}'warn-incomplete-record-updates:Warn when a record update could fail'
  278. {no-,}'warn-missing-fields:Warn when fields of a record are uninitialised'
  279. {no-,}'warn-missing-methods:Warn when class methods are undefined'
  280. {no-,}'warn-missing-signatures:Warn about top-level functions without signatures'
  281. {no-,}'warn-duplicate-constraints:Warn when a constraint appears duplicated in a type signature'
  282. {no-,}'warn-identities:Warn about uses of Prelude numeric conversions that are probably the identity (and hence could be omitted)'
  283. {no-,}'warn-incomplete-uni-patterns:Warn when a pattern match in a lambda expression or pattern binding could fail'
  284. {no-,}'warn-lazy-unlifted-bindings:(Deprecated) warn when a pattern binding looks lazy but must be strict'
  285. {no-,}'warn-missing-import-lists:Warn when an import declaration does not explicitly list all the names brought into scope'
  286. {no-,}'warn-missing-local-sigs:Warn about polymorphic local bindings without signatures'
  287. {no-,}'warn-monomorphism-restriction:Warn when the Monomorphism Restriction is applied'
  288. {no-,}'warn-name-shadowing:Warn when names are shadowed'
  289. {warn-orphans,warn-auto-orphans}':Warn when the module contains orphan instance declarations or rewrite rules'
  290. {no-,}'warn-overlapping-patterns:Warn about overlapping patterns'
  291. {no-,}'warn-tabs:Warn if there are tabs in the source file'
  292. {no-,}'warn-type-defaults:Warn when defaulting happens'
  293. {no-,}"warn-unrecognised-pragmas:Warn about uses of pragmas that GHC doesn't recognise"
  294. {no-,}'warn-unused-binds:Warn about bindings that are unused'
  295. {no-,}'warn-unused-imports:Warn about unnecessary imports'
  296. {no-,}"warn-unused-matches:Warn about variables in patterns that aren't used"
  297. {no-,}'warn-unused-do-bind:Warn about do bindings that appear to throw away values of types other than ()'
  298. {no-,}'warn-wrong-do-bind:Warn about do bindings that appear to throw away monadic values that you should have bound instead'
  299. {no-,}'warn-unsafe:Warn if the module being compiled is regarded to be unsafe'
  300. {no-,}'warn-safe:Warn if the module being compiled is regarded to be safe'
  301. {no-,}'warn-amp:Warn on definitions conflicting with the Applicative-Monad Proposal (AMP)'
  302. {no-,}'warn-typed-holes:Enable holes in expressions'
  303. )
  304. _describe -t flags 'ghc' _ghc_compiler_flags_list || compadd "$@"
  305. }
  306. _ghc_debugging_options ()
  307. {
  308. local _ghc_debugging_options_list
  309. _ghc_debugging_options_list=(
  310. "dump-hi:Dump the new interface to stdout"
  311. "dump-hi-diffs:Show the differences vs. the old interface"
  312. "dump-minimal-imports:Dump a minimal set of imports"
  313. "core-lint:Turn on internal sanity checking"
  314. "dump-asm:Dump assembly"
  315. "dump-bcos:Dump interpreter byte code"
  316. "dump-cmm:Dump C-- output"
  317. "dump-cpranal:Dump output from CPR analysis"
  318. "dump-cse:Dump CSE output"
  319. "dump-deriv:Dump deriving output"
  320. "dump-ds:Dump desugarer output"
  321. 'dump-flatC:Dump "flat" C'
  322. "dump-foreign:Dump foreign export stubs"
  323. "dump-hpc:Dump after instrumentation for program coverage"
  324. "dump-inlinings:Dump inlining info"
  325. "dump-occur-anal:Dump occurrence analysis output"
  326. "dump-opt-cmm:Dump the results of C-- to C-- optimising passes"
  327. "dump-parsed:Dump parse tree"
  328. "dump-prep:Dump prepared core"
  329. "dump-rn:Dump renamer output"
  330. "dump-rules:Dump rules"
  331. "dump-simpl:Dump final simplifier output"
  332. "dump-simpl-phases:Dump output from each simplifier phase"
  333. "dump-simpl-iterations:Dump output from each simplifier iteration"
  334. "dump-spec:Dump specialiser output"
  335. "dump-splices:Dump TH spliced expressions"
  336. "dump-stg:Dump final STG"
  337. "dump-stranal:Dump strictness analyser output"
  338. "dump-tc:Dump typechecker output"
  339. "dump-types:Dump type signatures"
  340. "dump-worker-wrapper:Dump worker-wrapper output"
  341. "dump-if-trace:Trace interface files"
  342. "dump-tc-trace:Trace typechecker"
  343. "dump-to-file:Dump to files instead of stdout"
  344. "dump-core-stats:Print a one-line summary of the size of the Core program at the end of the optimisation pipeline"
  345. "dump-llvm:Dump LLVM intermediate code"
  346. "dump-rule-firings:Dump rule firing info"
  347. "dump-rule-rewrites:Dump detailed rule firing info"
  348. "dump-vect:Dump vectoriser input and output"
  349. "dump-strsigs:Dump strictness signatures"
  350. "dump-vt-trace:Trace vectoriser"
  351. "dump-rn-trace:Trace renamer"
  352. "dump-rn-stats:Renamer stats"
  353. "dump-simpl-stats:Dump simplifier stats"
  354. "suppress-all:In core dumps, suppress everything (except for uniques) that is suppressible"
  355. "suppress-uniques:Suppress the printing of uniques in debug output (easier to use diff)"
  356. "suppress-idinfo:Suppress extended information about identifiers where they are bound"
  357. "suppress-module-prefixes:Suppress the printing of module qualification prefixes"
  358. "suppress-type-signatures:Suppress type signatures"
  359. "suppress-type-applications:Suppress type applications"
  360. "suppress-coercions:Suppress the printing of coercions in Core dumps to make them shorter"
  361. "no-debug-output:Suppress unsolicited debugging output"
  362. "ppr-debug:Turn on debug printing (more verbose)"
  363. "ppr-noprags:Don't output pragma info in dumps"
  364. "ppr-user-length:Set the depth for printing expressions in error msgs"
  365. "ppr-colsNNN:Set the width of debugging output. For example -dppr-cols200"
  366. "ppr-case-as-let:Print single alternative case expressions as strict lets"
  367. "source-stats:Dump haskell source stats"
  368. "cmm-lint:C-- pass sanity checking"
  369. "stg-lint:STG pass sanity checking"
  370. "stg-stats:Dump STG stats"
  371. "verbose-core2core:Show output from each core-to-core pass"
  372. "verbose-stg2stg:Show output from each STG-to-STG pass"
  373. "show-passes:Print out each pass name as it happens"
  374. "faststring-stats:Show statistics for fast string usage when finished"
  375. )
  376. _describe -t flags 'ghc' _ghc_debugging_options_list || compadd "$@"
  377. }
  378. _ghc_language_flags ()
  379. {
  380. local _ghc_language_flags_list
  381. _ghc_language_flags_list=(
  382. "AllowAmbiguousTypes:Allow the user to write ambiguous types, and the type inference engine to infer them"
  383. "Arrows:Enable arrow notation extension"
  384. "AutoDeriveTypeable:Automatically derive Typeable instances for every datatype and type class declaration"
  385. "BangPatterns:Enable bang patterns"
  386. "ConstraintKinds:Enable a kind of constraints"
  387. "CPP:Enable the C preprocessor"
  388. "ConstrainedClassMethods:Enable constrained class methods"
  389. "DataKinds:Enable datatype promotion"
  390. "DefaultSignatures:Enable default signatures"
  391. "DeriveDataTypeable:Enable deriving for the Data and Typeable classes"
  392. "DeriveGeneric:Enable deriving for the Generic class"
  393. "DisambiguateRecordFields:Enable record field disambiguation"
  394. "EmptyCase:Allow empty case alternatives"
  395. "EmptyDataDecls:Enable empty data declarations"
  396. "ExistentialQuantification:Enable existential quantification"
  397. "ExplicitForAll:Enable explicit universal quantification"
  398. "ExplicitNamespaces:Enable using the keyword type to specify the namespace of entries in imports and exports"
  399. "ExtendedDefaultRules:Use GHCi's extended default rules in a normal module"
  400. "FlexibleContexts:Enable flexible contexts"
  401. "FlexibleInstances:Enable flexible instances"
  402. "ForeignFunctionInterface:Enable foreign function interface"
  403. "FunctionalDependencies:Enable functional dependencies"
  404. "GADTs:Enable generalised algebraic data types"
  405. "GADTSyntax:Enable generalised algebraic data type syntax"
  406. "GeneralizedNewtypeDeriving:Enable newtype deriving"
  407. "Generics:Enable generic classes"
  408. "ImplicitParams:Enable Implicit Parameters"
  409. "ImpredicativeTypes:Enable impredicative types"
  410. "IncoherentInstances:Enable incoherent instances"
  411. "InterruptibleFFI:Enable interruptible FFI"
  412. "KindSignatures:Enable kind signatures"
  413. "LambdaCase:Enable lambda-case expressions"
  414. "LiberalTypeSynonyms:Enable liberalised type synonyms"
  415. "MonadComprehensions:Enable monad comprehensions"
  416. "MonoLocalBinds:Enable do not generalise local bindings"
  417. "MultiParamTypeClasses:Enable multi parameter type classes"
  418. "MultiWayIf:Enable multi-way if-expressions"
  419. "NamedFieldPuns:Enable record puns"
  420. "NegativeLiterals:Enable support for negative literals"
  421. "NewQualifiedOperators:Enable new qualified operator syntax"
  422. "NoImplicitPrelude:Don't implicitly import Prelude"
  423. "NoMonoPatBinds:Make pattern bindings polymorphic"
  424. "NoMonomorphismRestriction:Disable the monomorphism"
  425. "NoNPlusKPatterns:Disable support for n+k patterns"
  426. "NoTraditionalRecordSyntax:Disable support for traditional record syntax (as supported by Haskell 98) C {f = x}"
  427. "NullaryTypeClasses:Enable nullary (no parameter) type classes"
  428. "NumDecimals:Enable support for 'fractional' integer literals"
  429. "OverlappingInstances:Enable overlapping instances"
  430. "OverloadedLists:Enable overloaded lists"
  431. "OverloadedStrings:Enable overloaded string literals"
  432. "PArr:Enable parallel arrays"
  433. "PackageImports:Enable package-qualified imports"
  434. "ParallelArrays:Enable parallel arrays"
  435. "ParallelListComp:Enable parallel list comprehensions"
  436. "PatternGuards:Enable pattern guards"
  437. "PolyKinds:Enable kind polymorphism"
  438. "PolymorphicComponents:Enable polymorphic components for data constructors"
  439. "QuasiQuotes:Enable quasiquotation"
  440. "Rank2Types:Enable rank-2 types"
  441. "RankNTypes:Enable rank-N types"
  442. "RebindableSyntax:Employ rebindable syntax"
  443. "RecordWildCards:Enable record wildcards"
  444. "RecursiveDo:Enable recursive do (mdo) notation"
  445. "RelaxedPolyRec:Relaxed checking for mutually-recursive polymorphic functions"
  446. "Safe:Enable the Safe Haskell Safe mode"
  447. "ScopedTypeVariables:Enable lexically-scoped type variables"
  448. "StandaloneDeriving:Enable standalone deriving"
  449. "TemplateHaskell:Enable Template Haskell"
  450. "TransformListComp:Enable transform list comprehensions"
  451. "TypeFamilies:Enable type families"
  452. "TypeOperators:Enable type operators"
  453. "TypeSynonymInstances:Enable type synonyms"
  454. "Trustworthy:Enable the Safe Haskell Trustworthy mode"
  455. "UnboxedTuples:Enable unboxed tuples"
  456. "UndecidableInstances:Enable undecidable instances"
  457. "UnicodeSyntax:Enable unicode syntax"
  458. "UnliftedFFITypes:Enable unlifted FFI types"
  459. "Unsafe:Enable Safe Haskell Unsafe mode"
  460. "ViewPatterns:Enable view patterns"
  461. 'MagicHash:Allow "#" as a postfix modifier on identifiers'
  462. )
  463. _describe -t flags 'ghc' _ghc_language_flags_list || compadd "$@"
  464. }
  465. #
  466. # ghc-pkg
  467. #
  468. _ghc_pkg ()
  469. {
  470. WORDS=()
  471. for w in $words[1,(($CURRENT - 1))]; do
  472. if [[ $w != --* ]]; then WORDS+=$w; fi
  473. done
  474. _arguments '*:command:_ghc_pkg_command'
  475. }
  476. _ghc_pkg_command()
  477. {
  478. local -a _ghc_pkg_cmds
  479. _ghc_pkg_cmds=(
  480. "register:Register the package using package description"
  481. "update:Register the package (overwriting existing package)"
  482. "unregister:Unregister the specified package"
  483. "expose:Expose the specified package"
  484. "hide:Hide the specified package"
  485. "list:List registered packages"
  486. "find-module:List registered packages exposing module"
  487. "latest:Prints the highest registered version of a package"
  488. "check:Check the consistency of package dependencies and list broken packages"
  489. "describe:Give the registered description for the specified package"
  490. "field:Extract the specified field of the package description"
  491. "dump:Dump the registered description for every package"
  492. )
  493. if (( $#WORDS == 1 )); then
  494. _describe -t commands 'command' _ghc_pkg_cmds || compadd "$@"
  495. else
  496. local curcontext="$curcontext"
  497. cmd="${${_ghc_pkg_cmds[(r)$WORDS[2]:*]%%:*}}"
  498. if (( $#cmd )); then
  499. _arguments \
  500. "--user[Use current user's package database]" \
  501. '--global[User the global package database]' \
  502. {-f,--package-conf=}'[Use the specified package config file]:Package config file:_files' \
  503. '--no-user-package-conf[Never reader the user package config]' \
  504. {-V,--version}'[Output version information and exit]' \
  505. '--force[Ignore missing directories and libraries only]' \
  506. {-g,--auto-ghci-libs}'[Automatically build libs for GHCi]' \
  507. {-?,--help}'[Display this help and exit]' \
  508. '--simple-output[Print output in easy-to-parse format for some commands]' \
  509. '--names-only[Only print package names, not versions]' \
  510. '--ignore-case[Ignore case for substring matching]' \
  511. '*:argument:_ghc_pkg_'$cmd
  512. else
  513. _message "unknown ghc-pkg command: $WORDS[2]"
  514. fi
  515. fi
  516. }
  517. _ghc_pkg_unregister () { _ghc_pkg_list_packages }
  518. _ghc_pkg_expose () { _ghc_pkg_list_packages }
  519. _ghc_pkg_hide () { _ghc_pkg_list_packages }
  520. _ghc_pkg_latest () { _ghc_pkg_list_packages }
  521. _ghc_pkg_describe () { _ghc_pkg_list_packages }
  522. _ghc_pkg_field ()
  523. {
  524. _ghc_pkg_available_packages
  525. if (( $#WORDS == 2 )); then
  526. compadd "$@" -a -- _ghc_pkg_packages
  527. elif (( $#WORDS == 3 )); then
  528. compset -P '*,'
  529. compset -S ',*'
  530. compadd "$@" -S ',' -q -- \
  531. name version license copyright maintainer \
  532. stability homepage package-url description \
  533. category author exposed exposed-modules \
  534. hidden-modules import-dirs hs-libraries \
  535. extra-libraries extra-ghci-libraries include-dirs \
  536. includes depends hugs-options cc-options ld-options \
  537. framework-dirs frameworks haddock-interfaces \
  538. haddock-html
  539. fi
  540. }
  541. _ghc_pkg_register () { _files }
  542. _ghc_pkg_update () { _files }
  543. _ghc_pkg_list () { _ghc_pkg_list_packages }
  544. _ghc_pkg_find-module ()
  545. {
  546. if (( $#WORDS == 2)); then
  547. if ( [[ ${+_ghc_modules} -eq 0 ]] || _cache_invalid GHC_MODULES ) &&
  548. ! _retrieve_cache GHC_MODULES;
  549. then
  550. _ghc_modules=( $(ghc-pkg dump | sed -n '/^exposed-modules:/{s/^exposed-modules:[ ]\+\(.*\)$/\1/;s/ /\n/;p;be};b;:e;n;/^ /{s/^[ ]\+\(.*\)$/\1/;s/ /\n/;p;be}') )
  551. _store_cache GHC_MODULES _ghc_modules
  552. fi
  553. compadd "$@" -a -- _ghc_modules
  554. fi
  555. }
  556. _ghc_pkg_dump () {}
  557. _ghc_pkg_check () {}
  558. _ghc_pkg_available_packages ()
  559. {
  560. if ( [[ ${+_ghc_pkg_packages_pkgs} -eq 0 ]] || _cache_invalid GHC_PACKAGES ) &&
  561. ! _retrieve_cache GHC_PACKAGES;
  562. then
  563. _ghc_pkg_packages=( $(ghc-pkg list --simple-output --names-only) )
  564. _store_cache GHC_PACKAGES _ghc_pkg_packages
  565. fi
  566. }
  567. _ghc_pkg_list_packages ()
  568. {
  569. _ghc_pkg_available_packages
  570. compadd "$@" -a -- _ghc_pkg_packages
  571. }
  572. #
  573. # dispatcher
  574. #
  575. case $service in
  576. ghc)
  577. _ghc_compiler
  578. ;;
  579. ghci)
  580. _ghc_ghci
  581. ;;
  582. ghc-pkg)
  583. _ghc_pkg
  584. ;;
  585. esac