Last active

How to make ghc loop.

  • Download Gist
1 2 3 4 5 6 7 8 9 10 11
{-# LANGUAGE EmptyDataDecls #-}
data Empty
data Loop = CLoop (Loop -> Empty)
loop_step :: Loop -> Empty
loop_step b@(CLoop f) = f b
loop :: Empty
loop = loop_step (CLoop loop_step)

It works fine if you turn Loop into a newtype.

You don't even need the EmptyDataDecls; changing Empty to () loops as well. Did you file a bug?

Apparently this is a known bug of the inliner. Adding NOINLINE fixes the problem.

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.