Opened 3 years ago
Closed 3 years ago
#11159 closed bug (fixed)
'-interactive-print myPrint' forgotten after :load or :reload
Reported by: | hukarere | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | 8.0.1 |
Component: | Documentation | Version: | 7.6.3 |
Keywords: | Cc: | bravit, watashi | |
Operating System: | Unknown/Multiple | Architecture: | Unknown/Multiple |
Type of failure: | None/Unknown | Test Case: | |
Blocked By: | Blocking: | ||
Related Tickets: | #5461 | Differential Rev(s): | |
Wiki Page: |
Description
Hi,
I would like to use a custom print function. I tried all possible ways for setting it: (1) running ghci -interactive-print myPrint; (2) adding ':set -interactive-print myPrint' to ~/.ghci; (3) typing ':set -interactive-print myPrint' interactively. It works, but only before :load or :reload. After that,it's forgotten (standard print used again) and I have to type ':set -interactive-print myPrint' again. Is there a way to make this setting persistent, i. e. survive after :load or :reload?
Thanks.
Change History (8)
comment:1 Changed 3 years ago by
Version: | 7.10.2 → 7.6.3 |
---|
comment:2 Changed 3 years ago by
Cc: | bravit added |
---|---|
Related Tickets: | → #5461 |
Still a problem with HEAD.
Maybe the creator of this feature, @bravit, knows a solution?
comment:3 Changed 3 years ago by
Component: | Compiler → GHCi |
---|
comment:4 Changed 3 years ago by
This was fixed already in https://phabricator.haskell.org/D867
It works as expected in HEAD, but not in 7.10.3.
comment:5 Changed 3 years ago by
Cc: | watashi added |
---|
Hi bravit, thanks for having a look.
After a :reload
, the interactive printer doesn't work anymore. Here is an example.
$ cat Test.hs module SpecPrinter where import System.IO sprint a = putStrLn $ show a ++ "!"
$ ~/ghc-devel2/inplace/bin/ghc-stage2 --version The Glorious Glasgow Haskell Compilation System, version 7.11.20151216
$ ~/ghc-devel2/inplace/bin/ghc-stage2 --interactive -interactive-print=SpecPrinter.sprint Test GHCi, version 7.11.20151216: http://www.haskell.org/ghc/ :? for help [1 of 1] Compiling SpecPrinter ( Test.hs, interpreted ) Ok, modules loaded: SpecPrinter. *SpecPrinter> "hi" "hi"! *SpecPrinter> :reload Ok, modules loaded: SpecPrinter. *SpecPrinter> "hi" "hi"
Note that after the :reload
, the exclamation mark (!
) isn't printed anymore.
Do you agree this is not working as expected? I'm seeing the same behaviour with ghc-7.10.3 as with HEAD.
CC @watashi, as the author of D867. I also note that a test was missing from that Diff, so maybe it recently got broken again?
comment:6 Changed 3 years ago by
Hi thomie,
If interactive printing function is defined in external package then it is kept after reloading (thanks to D867, now in HEAD). If it is defined locally then it is no more effective after reloading, it's a new function in some way. I consider this behaviour as reasonable. Don't you agree?
comment:8 Changed 3 years ago by
Component: | GHCi → Documentation |
---|---|
Milestone: | → 8.0.1 |
Resolution: | → fixed |
Status: | new → closed |
Ah, ok, I missed the "external package" part. Sounds reasonable.
I updated the User's Guide to mention this.
Thanks!
I forgot to mention my version of ghc: 7.6.3.