<<loop>> error message

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

<<loop>> error message

Omari Norman-2
I compiled some code with GHC 7.6.3 that produces a simple error at runtime

myProgramName: <<loop>>

At which point the program exits with code 1.

Is there documentation for this error anywhere? Does it mean I have some infinite loop in my code somewhere? If so, does GHC catch all infinite loops? I have never gotten this error before. Thanks.

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: <<loop>> error message

Mihai Maruseac
On Sat, Jun 22, 2013 at 12:41 AM, Omari Norman <[hidden email]> wrote:
> I compiled some code with GHC 7.6.3 that produces a simple error at runtime
>
> myProgramName: <<loop>>
>
> At which point the program exits with code 1.
>
> Is there documentation for this error anywhere? Does it mean I have some
> infinite loop in my code somewhere? If so, does GHC catch all infinite
> loops? I have never gotten this error before. Thanks.

Hi,

Indeed, you have an infinite loop in your code. However, not all
infinite loops are catcheable by the mechanism employed there, it
would be very hard to do so.

Basically, your code reduces after several transformation to something
on the lines of

f = f ...

Here is a simple program:

main = do
  print g
  print $ f 3

g :: Int
g = 3

f :: Int -> Int
f x = 1 + f x

This results in an infinite loop in f but it is not caught because
there is an argument given to the function f. However, if we had

g = g + 1

This will be turned into the loop message.

--
MM
"All we have to decide is what we do with the time that is given to us"

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: <<loop>> error message

Tobias Dammers
On Sat, Jun 22, 2013 at 06:09:58AM +0300, Mihai Maruseac wrote:

> On Sat, Jun 22, 2013 at 12:41 AM, Omari Norman <[hidden email]> wrote:
> > I compiled some code with GHC 7.6.3 that produces a simple error at runtime
> >
> > myProgramName: <<loop>>
> >
> > At which point the program exits with code 1.
> >
> > Is there documentation for this error anywhere? Does it mean I have some
> > infinite loop in my code somewhere? If so, does GHC catch all infinite
> > loops? I have never gotten this error before. Thanks.
>
> Hi,
>
> Indeed, you have an infinite loop in your code. However, not all
> infinite loops are catcheable by the mechanism employed there, it
> would be very hard to do so.

Some are even impossible to catch at all, a.k.a. the Halting Problem.

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe