a minor, but practical, ghci patch, aiming to reduce some of the
confusion about ghci-related flags (as opposed to ghci options).

also adds :show commands for currently active languages and
package options. please review and apply to HEAD and STABLE.

issues:

   - there are more flags than options for controlling ghci behaviour,
       but none of those flags are shown by :set, making them difficult
       to find/know about/use.

   - there are now many language options, but there's no way to
       determine which are currently active in a ghci session (can
       be especially confusing if loading a module with pragmas,
       because the languages enabled there are not inherited by
       the ghci session..; is that intended, btw?)

   - there's no way to determine which -package flags are needed
       to move from a ghci-session (default: everything exposed)
       to ghc-compilation (default: everything hidden), or to a
       cabal package (default: everything hidden)

solutions in this patch:

- make :help refer to "Interactive-mode options" in the Flag reference (shouldn't that be "Interactive-mode flags"?)

   - make :set show ghci-related flags, as listed in that section
       (currently: printing and debugging flags; any others?)

   - make ":show languages" display the currently active languages

- make ":show packages" display the currently active package options (this doesn't help much, as it won't show the
       _implicitly_ loaded packages; see the -package ghc
       example below; is there a way to do that?)

there are lots of other flags whose settings cannot currently be determined in a ghci session (such as import paths), but
i thought i'd make a start;-).

claus

-------------------- example session:
Prelude> :set
options currently set: none.
GHCi-related dynamic flag settings:
 -fno-print-explicit-foralls
 -fprint-bind-result
 -fno-break-on-exception
 -fno-break-on-error
 -fno-print-evld-with-show

Prelude> :show languages
active language flags:
 -XImplicitPrelude
 -XMonomorphismRestriction
 -XMonoPatBinds

Prelude> :set -fglasgow-exts
Prelude> :show languages
active language flags:
 -XPatternGuards
 -XUnicodeSyntax
 -XMagicHash
 -XPolymorphicComponents
 -XExistentialQuantification
 -XKindSignatures
 -XPatternSignatures
 -XEmptyDataDecls
 -XParallelListComp
 -XForeignFunctionInterface
 -XUnliftedFFITypes
 -XPartiallyAppliedClosedTypeSynonyms
 -XRankNTypes
 -XTypeOperators
 -XRecursiveDo
 -XImplicitPrelude
 -XGADTs
 -XTypeFamilies
 -XMonomorphismRestriction
 -XMonoPatBinds
 -XRelaxedPolyRec
 -XImplicitParams
 -XScopedTypeVariables
 -XUnboxedTuples
 -XStandaloneDeriving
 -XDeriveDataTypeable
 -XTypeSynonymInstances
 -XFlexibleContexts
 -XFlexibleInstances
 -XConstrainedClassMethods
 -XMultiParamTypeClasses
 -XFunctionalDependencies
 -XGeneralizedNewtypeDeriving

Prelude> :show packages
active package flags:
Prelude> :set -package ghc
package flags have changed, ressetting and loading new packages...
Loading package old-locale-1.0 ... linking ... done.
Loading package old-time-1.0 ... linking ... done.
Loading package filepath-1.0 ... linking ... done.
Loading package directory-1.0 ... linking ... done.
Loading package array-0.1 ... linking ... done.
Loading package containers-0.1 ... linking ... done.
Loading package hpc-0.5 ... linking ... done.
Loading package bytestring-0.9 ... linking ... done.
Loading package pretty-1.0 ... linking ... done.
Loading package packedstring-0.1 ... linking ... done.
Loading package template-haskell ... linking ... done.
Loading package Win32-2.1 ... linking ... done.
Loading package process-1.0 ... linking ... done.
Loading package Cabal-1.2.0 ... linking ... done.
Loading package random-1.0 ... linking ... done.
Loading package haskell98 ... linking ... done.
Loading package ghc-6.9.20070915 ... linking ... done.

Prelude> :show packages
active package flags:
 -package ghc


Attachment: ghci-show-ghci-related-flags.diff
Description: Binary data

_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to