Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
  • Haskell
import Control.Monad
forever $ pure ()

forever in an IO context runs an 'action' endlessly. pure lifts a value to the IO monad. _() is the unit value. This translates to 'forever do nothing'.
let x = x in x

x will be defined as itself, and recurse infinitely when evaluated
import Control.Monad
forever (getLine >>= putStrLn)
loop
   null;
end loop;

null; means "do nothing"

New implementation...
< >
programming-idioms.org