Difference between revisions of "Unix tools/yes"

From HaskellWiki
Jump to: navigation, search
m
(Deleting page that hasn't been updated for over 10 years)
Line 1: Line 1:
== yes ==
 
 
A simple utility to repeatedly print y to standard out.
 
 
Here are some various ways this simple program can be written.
 
 
<haskell>
 
main = let y = putStrLn "y" >> y in y
 
</haskell>
 
 
<haskell>
 
main = putStrLn $ concat $ repeat "y\n"
 
</haskell>
 
 
<haskell>
 
main = let y = 'y' : '\n' : y in putStrLn y
 
</haskell>
 
 
<haskell>
 
main = putStrLn "y" >> main
 
</haskell>
 

Revision as of 14:27, 6 February 2021