Ticket #668 (closed bug: wontfix)
Compiler loops indefinitely on Morris-style fixed-point operator
Description
Consider the following programs:
-- program 1.hs
newtype F a = F {unF :: F a -> a}
fix f = (\x -> f (unF x x)) (F (\x -> f (unF x x)))
fac = fix (\f -> \n -> if n == 0 then 1 else n * f (n - 1))
main = return ()
-- program 2: morris2.hs
newtype F a = F {unF :: F a -> a}
fix f = (\x -> f (unF x x)) (F (\x -> f (unF x x)))
fac = fix (\f -> \n -> if n == 0 then 1 else n * f (n - 1))
main = print (fac 2)
The first one compiles just fine; the second however causes GHC to go in an infinite loop:
$ ghc -c morris1.hs $
$ ghc -c morris2.hs (loops)
Change History
Note: See
TracTickets for help on using
tickets.
