Difference between revisions of "Unix tools/yes"

From HaskellWiki
Jump to navigation Jump to search
 
m
Line 2: Line 2:
   
 
A simple utility to repeatedly print y to standard out.
 
A simple utility to repeatedly print y to standard out.
  +
  +
Here are some various ways this simple program can be written.
   
 
<haskell>
 
<haskell>
 
main = let y = putStrLn "y" >> y in y
 
main = let y = putStrLn "y" >> y in y
  +
</haskell>
  +
  +
<haskell>
  +
main = putStrLn $ concat $ repeat "y\n"
 
</haskell>
 
</haskell>

Revision as of 20:38, 19 December 2007

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"