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

GHC ghc-devs at haskell.org
Sun Jun 15 19:43:37 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
      Resolution:                   |         Keywords:  infinite recursion
Operating System:                   |     Architecture:  Unknown/Multiple
  Unknown/Multiple                  |       Difficulty:  Unknown
 Type of failure:  None/Unknown     |       Blocked By:
       Test Case:                   |  Related Tickets:
        Blocking:                   |
------------------------------------+--------------------------------------

Comment (by j80JjBjVNRMajmA):

 You will get used to infinite lists in Haskell. Do you know this one
 `[1..]`?

 `repeat` is defined in Data.List
 (http://www.haskell.org/ghc/docs/latest/html/libraries/base/Data-
 List.html) and also used there to define `replicate`.

 One importat use case is to define the `ZipList` Applicative instance:

 {{{
  pure = ZipList . repeat
 }}}

 in https://hackage.haskell.org/package/base-4.7.0.0/docs/Control-
 Applicative.html#t:ZipList.

 It is hard to motivate all the greatness the Haskell-way brings in a Bug-
 comment.

 Another note on topic: Merely checking, that the recursive function call
 has different arguments does not protect you from infinite recusion:

 {{{
 f x = f $ x + 1
 }}}

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


More information about the ghc-tickets mailing list