Hello,
I am trying to use N. Mitchell's CmdArgs and I would like one of the fields to store the current time. A minimal example below:
{-# LANGUAGE DeriveDataTypeable #-}
import System.Console.CmdArgs
import System.Time
data FuzzyTimeConf = FuzzyTimeConf { time :: String } deriving (Show, Data, Typeable)
ftConf = FuzzyTimeConf { time = confDefaultTime }
confDefaultTime = "it is here that I would like to get the current time"
main :: IO ()
main = do
print =<< cmdArgs ftConf
I want confDefaultTime to store the current time as HH:MM, so I guess I will also need to extract it in some way.
I've tried many different versions and can't come up with anything working. confDefaultTime can't be an IO String because than it can't derive Show and Data which is required for cmdArgs to work in FuzzyTimeConf. However, I don't seem to be able to find a way to make it a String and hold the actual current time.
Can you help me, please?