#1201: ghci runs Template Haskell splices 4 times
------------------------------+---------------------------------------------
Reporter: igloo | Owner: simonpj
Type: bug | Status: new
Priority: low | Milestone: _|_
Component: Template Haskell | Version: 6.6
Severity: normal | Resolution:
Keywords: | Difficulty: Unknown
Testcase: ghci018 | Architecture: Unknown
Os: Unknown |
------------------------------+---------------------------------------------
Changes (by simonpj):
* milestone: 6.6.2 => _|_
* priority: normal => low
* owner: => simonpj
Comment:
GHCi tries to typecheck the fragment you type in several different ways.
When you type an expression 'e' at the command prompt, GHC tries to
typecheck the following monadic statements:
* `it <- e; print it`
* `it <- e`
* `let it = e; print it`
The first one that typechecks wins. But typechecking runs the TH splices;
hence the behaviour you see.
It's debatable whether this is a bug. Up to now I have not attempted to
guarantee that splices are run only once. It would certainly be possible
to change GHCi to guarantee this. (I.e. a couple of hours, not a couple
of days.) But I don't think we'll do it for the 6.6 branch, unless you
yell really loudly; and the more people that say "this would really help
me" the more likely it is that we'll do it on the HEAD.
So, if you are a GHC user who cares about this point, add a comment to
this bug report. Thanks.
Simon
PS: why four times, not three? It's a rather clunky riff on the third
item, to improve error messages.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1201>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs