[GHC] #9207: Detect obvious cases of infinite recursion.

GHC ghc-devs at haskell.org
Sun Jun 15 16:11:44 UTC 2014


#9207: Detect obvious cases of infinite recursion.
--------------------------------------+------------------------------------
       Reporter:  mrugiero            |             Owner:
           Type:  feature request     |            Status:  new
       Priority:  normal              |         Milestone:
      Component:  Compiler            |           Version:  7.8.2
       Keywords:  infinite recursion  |  Operating System:
   Architecture:  Unknown/Multiple    |  Unknown/Multiple
     Difficulty:  Unknown             |   Type of failure:  None/Unknown
     Blocked By:                      |         Test Case:
Related Tickets:                      |          Blocking:
--------------------------------------+------------------------------------
 Pure functions are guaranteed to return the same value if the same
 arguments are used. Because of that, a compiler could be able to detect
 infinite recursion in the form of a function calling itself with the same
 arguments (case, some distracted programmer forgot to apply the function
 tail to a list). The way I see it, one of Haskell's main selling points is
 that it helps the programmer to avoid sources of bugs as much as it can,
 and infinite recursion is one of the few that stand unchecked. I
 specifically point to this example because both, I'm a newbie and made
 that newbie mistake, and think it shouldn't be hard to implement to the
 parsing stage of the compiler/interpreter. It probably should throw an
 error when this happens in pure functions, and maybe an opt-in warning if
 it happens in monads.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9207>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list