Take notes on the command line: Difference between revisions

added haskell
(→‎{{header|Perl}}: Cleaned up.)
(added haskell)
Line 54:
] with-file-appender
] if-empty</lang>
 
=={{header|Haskell}}==
<lang haskell>import System.Environment (getArgs)
import System.Time (getClockTime)
 
main :: IO ()
main = do
args <- getArgs
if null args
then catch (readFile "notes.txt" >>= putStr)
(\_ -> return ())
else
do ct <- getClockTime
appendFile "notes.txt" $ show ct ++ "\n\t" ++ unwords args ++ "\n"</lang>
 
Sample output after a few runs:
<pre>
Thu Apr 22 19:01:41 PDT 2010
Test line 1.
Thu Apr 22 19:01:45 PDT 2010
Test line 2.
</pre>
 
=={{header|JavaScript}}==
Anonymous user