Logo

Programming-Idioms

History of Idiom 50 > diff from v58 to v59

Edit summary for version 59 by yyyyy:
New Haskell implementation by user [yyyyy]

Version 58

2020-02-07, 19:28:07

Version 59

2020-04-29, 11:31:50

Idiom #50 Make an infinite loop

Write a loop which has no end clause.

Idiom #50 Make an infinite loop

Write a loop which has no end clause.

Imports
import Control.Monad
Code
forever $ pure ()
Comments bubble
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'.