[GHC] #14527: Warn on recursive bindings
GHC
ghc-devs at haskell.org
Sun Nov 26 14:50:12 UTC 2017
#14527: Warn on recursive bindings
-------------------------------------+-------------------------------------
Reporter: chrisdone | Owner: (none)
Type: feature request | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.2.1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by nh2):
**GHC 7.10 already had this feature**, but it disappeared with 8.0, and
it's not clear to me if intentionally or accidentally. It would be great
to find out.
In 7.10, you could simply used a BangPattern to forbid recursive variable
bindings. Example
{{{
Recursive bang-pattern or unboxed-tuple bindings aren't allowed:
!x = x
}}}
And it said in the manual:
{{{
a bang-pattern binding must be non-recursive
}}}
It was removed for GHC 8.0 in these commits:
*
https://github.com/ghc/ghc/commit/e7985ed23ddc68b6a2e4af753578dc1d9e8ab4c9
#diff-47b9f40b0ede605e7b6bcb330b43ad53L1678
* https://github.com/ghc/ghc/commit/46a03fbec#diff-
02e7842997523ff8a5ad0312df2edfe2L10348
The question is: Why was this removed?
Was it accidental, or did people find a legitimate use case for strict
recursive variable let bindings?
If not, we could simply re-introduce that, without a language extension
(though we might still add the proposed language extension to get warnings
even without bangs).
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14527#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list