STMonadTrans 0.4.7 → 0.4.8
raw patch · 4 files changed
+34/−27 lines, 4 filesdep −faildep ~basedep ~tasty-quickcheckPVP ok
version bump matches the API change (PVP)
Dependencies removed: fail
Dependency ranges changed: base, tasty-quickcheck
API changes (from Hackage documentation)
+ Control.Monad.ST.Trans.Internal: instance (GHC.Base.Monad m, GHC.Base.Alternative m) => GHC.Base.Alternative (Control.Monad.ST.Trans.Internal.STT s m)
Files
- Control/Monad/ST/Trans/Internal.hs +4/−0
- STMonadTrans.cabal +16/−25
- changelog.md +9/−2
- test/Main.hs +5/−0
Control/Monad/ST/Trans/Internal.hs view
@@ -105,6 +105,10 @@ (STTRet s3 x) <- n s2 return (STTRet s3 (f x)) +instance (Monad m, Alternative m) => Alternative (STT s m) where+ empty = STT $ \_ -> empty+ STT m <|> STT n = STT $ \s# -> m s# <|> n s#+ -- Instances of other monad classes instance (MonadError e m, Functor m) => MonadError e (STT s m) where
STMonadTrans.cabal view
@@ -1,15 +1,15 @@ cabal-version: 1.18-name: STMonadTrans-version: 0.4.7-license: BSD3-license-file: LICENSE-author: Josef Svenningsson-maintainer: josef.svenningsson@gmail.com, Andreas Abel+name: STMonadTrans+version: 0.4.8+license: BSD3+license-file: LICENSE+author: Josef Svenningsson+maintainer: Andreas Abel, josef.svenningsson@gmail.com homepage: https://github.com/josefs/STMonadTrans bug-reports: https://github.com/josefs/STMonadTrans/issues-category: Monads-build-type: Simple-synopsis: A monad transformer version of the ST monad+category: Monads+build-type: Simple+synopsis: A monad transformer version of the ST monad description: A monad transformer version of the ST monad. .@@ -21,9 +21,10 @@ Maybe and combinations of their corresponding monad transformers. Tested-With:- GHC == 9.6.1- GHC == 9.4.5- GHC == 9.2.7+ GHC == 9.8.1+ GHC == 9.6.3+ GHC == 9.4.8+ GHC == 9.2.8 GHC == 9.0.2 GHC == 8.10.7 GHC == 8.8.4@@ -31,9 +32,6 @@ GHC == 8.4.4 GHC == 8.2.2 GHC == 8.0.2- GHC == 7.10.3- GHC == 7.8.4- GHC == 7.6.3 extra-doc-files: README.md@@ -46,15 +44,11 @@ library default-language: Haskell2010 build-depends:- base >= 4.6 && < 5+ base >= 4.9 && < 5 , transformers >= 0.2.0.0 && < 0.7 , mtl >= 1.1 , array - -- MonadFail for GHC <= 7- if impl(ghc < 8.0)- build-depends: fail- exposed-modules: Control.Monad.ST.Trans Control.Monad.ST.Trans.Internal@@ -72,10 +66,7 @@ ghc-options: -Wall -fwarn-tabs-- if impl(ghc >= 8.0)- ghc-options:- -Wcompat+ -Wcompat test-suite test default-language: Haskell2010@@ -87,6 +78,6 @@ , array , base , transformers- , tasty >= 0.11.0.4 && < 1.5+ , tasty >= 0.11.0.4 && < 1.6 , tasty-quickcheck >= 0.8.4 && < 0.11 , tasty-hunit >= 0.9.2 && < 0.11
changelog.md view
@@ -1,11 +1,18 @@-0.4.7+0.4.8 -- 2023-01-04 + * Added `Alternative` instance for `STT`, by William Rusnack+ (PR [#33](https://github.com/josefs/STMonadTrans/pull/33)).+ * Drop support for GHC 7.+ * Tested with GHC 8.0.2 - 9.8.1.++0.4.7 -- 2023-05-18+ * Added `MonadIO` for `SST` (issue [#29](https://github.com/josefs/STMonadTrans/issues/29)). * Make `transformers` dependency explicit. * Bump `cabal-version` of `STMonadTrans.cabal` to 1.18. * Tested with GHC 7.6.3 - 9.6.1. -0.4.6+0.4.6 -- 2021-08-21 * Warning-free for all supported GHC versions (7.6 -- 9.2). * Drop `splitBase` cabal flag (`base >= 4` is already assumed).
test/Main.hs view
@@ -4,6 +4,7 @@ import GHC.STRef (STRef) import GHC.Arr (Array, listArray, (//))+import Control.Applicative ((<|>), empty) import Control.Monad.ST.Trans import Control.Monad.IO.Class import Control.Monad.Trans.Class@@ -16,6 +17,10 @@ \x -> runSTT (return x) == Just (x :: Int), testProperty "STT respects MonadTrans" $ \m -> runSTT (lift m) == (m :: Maybe Int),+ testProperty "STT respects Alternative Left" $+ \m -> runSTT (lift m <|> empty) == (m :: Maybe Int),+ testProperty "STT respects Alternative Right" $+ \m -> runSTT (empty <|> lift m) == (m :: Maybe Int), testProperty "newSTRef . readSTRef == id" $ \x -> runSTT ((newSTRef x :: STT s Maybe (STRef s Int)) >>= readSTRef) == Just x, testProperty "writeSTRef overwrite" $