[Haskell-beginners] main: <<loop>> ....?

David Virebayre dav.vire+haskell at gmail.com
Mon Aug 22 09:43:46 CEST 2011


2011/8/22 Sunil S Nandihalli <sunil.nandihalli at gmail.com>:
> I failed to tell that it prints "main : <<loop>>" and terminates... I
> was not clear about it in my previous email.. but that is what I
> meant. my appologies ..

That is exactly what ghc does. In some cases, it is able to detect a
function does nothing but loop, so it prints <<loop>> and terminates.

I don't know the details of how that works, I'm sure someone will be
able to explain it in detail, but consider this example :

david at pcdavid:~$ cat loop.hs
main = main
david at pcdavid:~$ ghc --make loop.hs
[1 of 1] Compiling Main             ( loop.hs, loop.o )
Linking loop ...
david at pcdavid:~$ ./loop
loop: <<loop>>



More information about the Beginners mailing list