monad-journal 0.6 → 0.6.0.1
raw patch · 3 files changed
+34/−7 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +4/−0
- Control/Monad/Trans/Journal.hs +27/−5
- monad-journal.cabal +3/−2
CHANGELOG.md view
@@ -1,5 +1,9 @@ # CHANGELOG +### 0.6.0.1++- Fixed bug about monad-control and type / data families.+ ### 0.6 - monad-control 1.0.0.1 qualified.
Control/Monad/Trans/Journal.hs view
@@ -1,11 +1,12 @@-{-# LANGUAGE GeneralizedNewtypeDeriving, TypeFamilies, UndecidableInstances #-}+{-# LANGUAGE CPP, GeneralizedNewtypeDeriving, TypeFamilies+ , UndecidableInstances #-} {-# OPTIONS_HADDOCK prune #-} ----------------------------------------------------------------------------- -- | -- Copyright : (C) Dimitri Sabadie -- License : BSD3--- +-- -- Maintainer : dimitri.sabadie@gmail.com -- Stability : stable -- Portability : portable@@ -68,7 +69,29 @@ put = lift . MS.put state = lift . MS.state +instance (MonadBase b m) => MonadBase b (JournalT w m) where+ liftBase = liftBaseDefault++#if MIN_VERSION_monad_control(1,0,0) instance Monoid w => MonadTransControl (JournalT w) where+ type StT (JournalT w) a = (a,w)+ liftWith f = JournalT $ StateT $ \w ->+ liftM (\x -> (x, w))+ (f $ \t -> liftM StJournal $ runJournalT (journal w >> t))+ restoreT = JournalT . StateT . const+ {-# INLINE liftWith #-}+ {-# INLINE restoreT #-}++instance (Monoid w,MonadBaseControl b m) => MonadBaseControl b (JournalT w m) where+ type StM (JournalT w m) a = ComposeSt (JournalT w) m a+ liftBaseWith = defaultLiftBaseWith StMJournal+ restoreM = defaultRestoreM+ {-# INLINE liftBaseWith #-}+ {-# INLINE restoreM #-}++#else++instance Monoid w => MonadTransControl (JournalT w) where newtype StT (JournalT w) a = StJournal {unStJournal :: (a, w)} liftWith f = JournalT $ StateT $ \w -> liftM (\x -> (x, w))@@ -77,9 +100,6 @@ {-# INLINE liftWith #-} {-# INLINE restoreT #-} -instance (MonadBase b m) => MonadBase b (JournalT w m) where- liftBase = liftBaseDefault- instance (Monoid w,MonadBaseControl b m) => MonadBaseControl b (JournalT w m) where newtype StM (JournalT w m) a = StMJournal { unStMJournal :: ComposeSt (JournalT w) m a }@@ -87,6 +107,8 @@ restoreM = defaultRestoreM unStMJournal {-# INLINE liftBaseWith #-} {-# INLINE restoreM #-}++#endif -- |Retrieve the value and the log history. runJournalT :: (Monoid w,Monad m) => JournalT w m a -> m (a,w)
monad-journal.cabal view
@@ -1,7 +1,7 @@ name: monad-journal license: BSD3 license-file: LICENSE-version: 0.6+version: 0.6.0.1 synopsis: Pure logger typeclass and monad transformer description: This package provides a typeclass for logging in pure code, or more generally, in any kind of@@ -30,7 +30,8 @@ , FlexibleInstances , MultiParamTypeClasses - other-extensions: FunctionalDependencies+ other-extensions: CPP+ , FunctionalDependencies , GeneralizedNewtypeDeriving , TypeFamilies , UndecidableInstances