[Haskell-beginners] IO String inside a CmdArgs data

Daniel Fischer daniel.is.fischer at googlemail.com
Fri Jan 14 23:40:29 CET 2011


On Friday 14 January 2011 21:45:49, Kamil Stachowski wrote:
> It is funny, indeed :)
>
> In fact, I am after all going to get unsafe because what Daniel Fischer
> wrote above worked perfectly until I wanted to add annotations to ftConf
> (the "&= summary" bit in http://community.haskell.org/~ndm/cmdargs/).
> The only way I can go around the errors I get is precisely unsafe, so
> ah, you only live once ;)

Well, you could try

setTime :: FuzzyTimeConf -> IO FuzzyTimeConf
setTime ftc = do
  now <- getClockTime
  return $ ftc{ time = convert now }

-- put annotations here
defaultFuzzyTimeConf = FuzzyTimeConf { ... }

main = do
  realFTConf <- setTime defaultTimeConf
  print =<< cmdArgs realFTConf

I haven't looked at cmdargs, so I've no idea whether that'll work, but it 
may be worth a try.



More information about the Beginners mailing list