[jhc] Loops.

John Meacham john at repetae.net
Thu Mar 20 13:39:30 EDT 2008


On Thu, Mar 20, 2008 at 06:13:48PM +0100, Lemmih wrote:
> x :: IO ()  -- This type signature works fine, <<loop>> is printed
> x :: a  -- This type signature blows the stack of jhc
> x = x
> main = x
> 
> Is this a known bug?

Well, it's not really a bug as all detection of loops is a bonus, if the
optimizer comes across something of exactly 'x = x' it will replace it
with error "<<loop>>" but not all loops optimize to that form.

x :: forall a . a
x = x 

turns into

x :: (a::*) -> a
x a = x a

in core, so it is not recognized as a loop. I doubt it will be much of a
problem in practice, and eta reduction is an anti-optimization in
general.


        John

-- 
John Meacham - ⑆repetae.net⑆john⑈


More information about the jhc mailing list