RosettaCodeData/Task/Take-notes-on-the-command-line/Haskell/take-notes-on-the-command-line.hs

13 lines
323 B
Haskell
Raw Permalink Normal View History

2013-04-11 01:07:29 -07:00
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"