persistent-refs 0.2 → 0.3
raw patch · 3 files changed
+10/−4 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Data.STRef.Persistent: asInt :: STRef s a -> Int
+ Data.STRef.Persistent: instance Eq (STRef s a)
+ Data.STRef.Persistent: instance Show (STRef s a)
- Control.Monad.ST.Persistent: type ST s a = STT s Identity a
+ Control.Monad.ST.Persistent: type ST s = STT s Identity
Files
- persistent-refs.cabal +1/−1
- src/Control/Monad/ST/Persistent/Internal.hs +3/−3
- src/Data/STRef/Persistent.hs +6/−0
persistent-refs.cabal view
@@ -1,5 +1,5 @@ name: persistent-refs-version: 0.2+version: 0.3 license: BSD3 license-file: LICENSE author: Adam C. Foltzer
src/Control/Monad/ST/Persistent/Internal.hs view
@@ -3,7 +3,7 @@ module Control.Monad.ST.Persistent.Internal where -import Control.Applicative (Applicative)+import Control.Applicative (Alternative, Applicative) import Control.Monad.State.Strict import Data.Functor.Identity import Data.IntMap (IntMap, empty)@@ -15,7 +15,7 @@ emptyHeap = Heap { heap = empty, next = minBound } -- | A persistent version of the 'Control.Monad.ST.ST' monad.-type ST s a = STT s Identity a+type ST s = STT s Identity -- | Run a computation that uses persistent references, and return a -- pure value. The rank-2 type offers similar guarantees to@@ -24,7 +24,7 @@ runST = runIdentity . runSTT newtype STT s m a = STT (StateT Heap m a)- deriving (Functor, Applicative, Monad, MonadIO, MonadTrans)+ deriving (Functor, Applicative, Alternative, Monad, MonadIO, MonadPlus, MonadTrans) -- | Run a computation that uses persistent references, and return a -- pure value. The rank-2 type offers similar guarantees to
src/Data/STRef/Persistent.hs view
@@ -20,6 +20,7 @@ module Data.STRef.Persistent ( -- * 'STRef's STRef+ , asInt -- * 'MonadRef' Operations , MonadRef(..) , modifyRef'@@ -33,6 +34,11 @@ import Unsafe.Coerce newtype STRef s a = STRef Int+ deriving (Eq, Show)++-- | Get the underlying 'Int' from an 'STRef'. Useful for debugging.+asInt :: STRef s a -> Int+asInt (STRef i) = i newSTRef :: Monad m => a -> STT s m (STRef s a) newSTRef x = STT $ do