Where-clause environments for GHCi
Often in ghci I'd like to interactively debug and play with functions in the where
clause of a top-level definition. Currently, this requires one to change the code, lifting the definitions in question to the top level and adding appropriate parameters.
Given a definition such as
top :: Int -> Int
top x = mult 4 - mult 3 + mult 2
where
mult n = x * n
it would be nice to type something such as :environment top 2
to put me in an envrionment where mult
is available and mult 4
will evaluate to 8
. (Obviously this becomes more useful with more complex definitions.)
Trac metadata
Trac field | Value |
---|---|
Version | 6.10.3 |
Type | FeatureRequest |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | GHCi |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |