{-# LANGUAGE CPP #-}
{-# OPTIONS_GHC -fno-warn-type-defaults #-}
module ALife.Creatur.Logger
(
Logger(..),
timestamp
) where
import Control.Monad.State (StateT)
#if MIN_VERSION_base(4,8,0)
import Data.Time (formatTime, getZonedTime, defaultTimeLocale)
#else
import Data.Time (formatTime, getZonedTime)
import System.Locale (defaultTimeLocale)
#endif
class Logger l where
writeToLog :: String -> StateT l IO ()
timestamp :: IO String
timestamp :: IO String
timestamp =
(ZonedTime -> String) -> IO ZonedTime -> IO String
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (TimeLocale -> String -> ZonedTime -> String
forall t. FormatTime t => TimeLocale -> String -> t -> String
formatTime TimeLocale
defaultTimeLocale String
"%y%m%d%H%M%S%z") IO ZonedTime
getZonedTime