monad-time 0.3.0.0 → 0.3.1.0
raw patch · 4 files changed
+21/−3 lines, 4 filesdep ~basePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base
API changes (from Hackage documentation)
Files
- CHANGELOG.md +6/−1
- monad-time.cabal +1/−1
- src/Control/Monad/Time.hs +10/−1
- test/Main.hs +4/−0
CHANGELOG.md view
@@ -1,2 +1,7 @@+# monad-time-0.3.1.0 (2018-04-09)+* Restored compatibility with GHC versions < 7.10+ ([#4](https://github.com/scrive/monad-time/issues/4)).+ # monad-time-0.3.0.0 (2018-04-03)-* Added a MonadTime instance for ReaderT UTCTime (#2).+* Added a MonadTime instance for ReaderT UTCTime+ ([#2](https://github.com/scrive/monad-time/pull/2)).
monad-time.cabal view
@@ -1,5 +1,5 @@ name: monad-time-version: 0.3.0.0+version: 0.3.1.0 synopsis: Type class for monads which carry the notion of the current time. description: 'MonadTime' type class for monads
src/Control/Monad/Time.hs view
@@ -1,4 +1,9 @@-{-# LANGUAGE FlexibleContexts, FlexibleInstances, UndecidableInstances #-}+{-# LANGUAGE CPP, FlexibleContexts, FlexibleInstances, UndecidableInstances #-}++#if __GLASGOW_HASKELL__ < 710+{-# LANGUAGE OverlappingInstances #-}+#endif+ module Control.Monad.Time (MonadTime(..)) where import Control.Monad.Trans@@ -13,6 +18,10 @@ instance MonadTime IO where currentTime = getCurrentTime +-- | This is @ReaderT UTCTime@ on purpose, to avoid breaking+-- downstream.+--+-- @since 0.3.0.0 instance {-# OVERLAPPING #-} Monad m => MonadTime (ReaderT UTCTime m) where currentTime = ask
test/Main.hs view
@@ -2,6 +2,7 @@ import Control.Monad.Reader import Control.Monad.State+import Data.Time.Clock import Control.Monad.Time @@ -11,3 +12,6 @@ -- Test that generic MonadTrans instance works. runReaderT currentTime 'x' >>= print evalStateT (runReaderT currentTime 'x') 'y' >>= print+ -- Test that ReaderT UTCTime instance works+ now <- getCurrentTime+ runReaderT currentTime now >>= print