2005-05-13 01:58:07 +00:00
|
|
|
{-# GLOBALOPTIONS -package mtl #-}
|
2005-04-24 08:51:33 +00:00
|
|
|
-- illustrates the use of static options in pragmas
|
|
|
|
|
|
|
|
import System.IO.Unsafe
|
|
|
|
import System.IO
|
|
|
|
import System.Process
|
|
|
|
|
|
|
|
resource = unsafe { field = date }
|
|
|
|
|
|
|
|
-- illustrates the use of the devil's work
|
|
|
|
date :: String
|
|
|
|
date = unsafePerformIO $ do
|
2005-05-21 11:23:18 +00:00
|
|
|
#if !defined(CYGWIN) || !defined(__MINGW32__)
|
2005-04-24 08:51:33 +00:00
|
|
|
(_,outh,_,proc) <- runInteractiveProcess "date" [] Nothing Nothing
|
2005-05-21 11:23:18 +00:00
|
|
|
#else
|
|
|
|
(_,outh,_,proc) <- runInteractiveProcess "@PREFIX@/../../bin/date" [] Nothing Nothing
|
|
|
|
#endif
|
2005-04-24 08:51:33 +00:00
|
|
|
waitForProcess proc
|
|
|
|
s <- hGetContents outh
|
|
|
|
return s
|
|
|
|
|