Unix tools/yes

From HaskellWiki
< Unix tools
Revision as of 15:19, 6 February 2021 by Gwern (talk | contribs) (Reverted edits by Tomjaguarpaw (talk) to last revision by Knome)

Jump to: navigation, search

yes

A simple utility to repeatedly print y to standard out.

Here are some various ways this simple program can be written.

  main = let y = putStrLn "y" >> y in y
  main =  putStrLn $ concat $ repeat "y\n"
  main = let y = 'y' : '\n' : y in putStrLn y
  main = putStrLn "y" >> main