packages feed

monad-time 0.2 → 0.3.0.0

raw patch · 4 files changed

+24/−9 lines, 4 filesdep ~basenew-uploader

Dependency ranges changed: base

Files

+ CHANGELOG.md view
@@ -0,0 +1,2 @@+# monad-time-0.3.0.0 (2018-04-03)+* Added a MonadTime instance for ReaderT UTCTime (#2).
+ README.md view
@@ -0,0 +1,4 @@+# monad-time [![Hackage version](https://img.shields.io/hackage/v/monad-time.svg?label=Hackage)](https://hackage.haskell.org/package/monad-time) [![Build Status](https://secure.travis-ci.org/scrive/monad-time.svg?branch=master)](http://travis-ci.org/scrive/monad-time)++A `MonadTime` type class for monads which carry the notion of the+current time.
monad-time.cabal view
@@ -1,16 +1,23 @@ name:                monad-time-version:             0.2-synopsis:            Type class for monads which carry the notion of the current time.-description:         'MonadTime' type class for monads which carry the notion of the current time.+version:             0.3.0.0+synopsis:            Type class for monads which carry+                     the notion of the current time.+description:         'MonadTime' type class for monads+                     which carry the notion of the current time. homepage:            https://github.com/scrive/monad-time license:             BSD3 license-file:        LICENSE author:              Andrzej Rybczak-maintainer:          andrzej@scrive.com+maintainer:          Andrzej Rybczak <andrzej@rybczak.net>,+                     Jonathan Jouty <jonathan@scrive.com>,+                     Mikhail Glushenkov <mikhail@scrive.com>+copyright:           Scrive AB category:            Control build-type:          Simple cabal-version:       >=1.10-tested-with:         GHC==7.4.2, GHC==7.6.3, GHC==7.8.4, GHC==7.10.3, GHC==8.0.1+extra-source-files:  README.md CHANGELOG.md+tested-with:         GHC == 7.4.2, GHC == 7.6.3, GHC == 7.8.4, GHC == 7.10.3,+                     GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.1  source-repository head   type:     git
src/Control/Monad/Time.hs view
@@ -1,9 +1,8 @@-{-# OPTIONS_GHC -fno-warn-deprecated-flags #-}-{-# LANGUAGE FlexibleContexts, FlexibleInstances, OverlappingInstances-  , UndecidableInstances #-}+{-# LANGUAGE FlexibleContexts, FlexibleInstances, UndecidableInstances #-} module Control.Monad.Time (MonadTime(..)) where  import Control.Monad.Trans+import Control.Monad.Reader (ReaderT, ask) import Data.Time  -- | Class of monads which carry the notion of the current time.@@ -14,8 +13,11 @@ instance MonadTime IO where   currentTime = getCurrentTime +instance {-# OVERLAPPING #-} Monad m => MonadTime (ReaderT UTCTime m) where+  currentTime = ask+ -- | Generic, overlapping instance.-instance (+instance {-# OVERLAPPABLE #-} (     MonadTime m   , MonadTrans t   , Monad (t m)