Unix tools/yes

From HaskellWiki
< Unix tools
Revision as of 03:24, 26 April 2021 by Atravers (talk | contribs) (Various minor changes)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

yes

A simple utility to repeatedly print "y" to standard output.

Here are some various ways this small 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
main = putStrLn $ cycle "y\n"