packages feed

HMap 1.1.9 → 1.2.0

raw patch · 3 files changed

+12/−2 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

ChangeLog view
@@ -1,3 +1,5 @@+1.2.0 : Added MonadFix instance for KeyT+ 1.1.9 : Added NOINLINE pragma for KeyT  1.1.8 : Added an Applicative instance for KeyT that is more non-strict than using the monad instance.
Data/HKeyPrivate.hs view
@@ -28,6 +28,7 @@ import Control.Applicative import Control.Monad.Identity import Control.Monad.Trans+import Control.Monad.Fix import Data.Hashable  instance Hashable Unique where@@ -76,6 +77,7 @@   Lift :: m a -> GD s m a   GetKey :: GD s m (HKey s a)   Split  :: KeyT s m a -> GD s m (m a)+  GDFix   :: MonadFix m => (a -> KeyT s m a) -> GD s m a  data TermM f a where   Return :: a -> TermM f a@@ -86,6 +88,8 @@   return = Return   (>>=)  = Bind ++ type Bind f a v = (forall w. f w -> (w -> TermM f a) -> v)  interpret :: Bind f a v -> (a -> v) -> TermM f a ->  v@@ -123,8 +127,11 @@   return   = KeyT . Return   c >>= f  = KeyT $ getKT c >>= getKT . f +instance MonadFix m => MonadFix (KeyT s m) where +  mfix m = KeyT $ Bind (Prim (GDFix m)) Return  + -- | Obtain a key in the key monad getKey :: KeyT s m (HKey s a) getKey = KeyT $ Bind (Prim GetKey) Return@@ -155,13 +162,14 @@ -- | Run a key monad. Existential type makes sure keys cannot escape. runKeyT :: forall m a. Monad m => (forall s. KeyT s m a) -> m a runKeyT (KeyT m) = loop m where-  loop :: TermM (GD T m) b -> m b+  loop :: TermM (GD T m) b -> m b	   loop = interpret bind return  where   {-# NOINLINE bind #-}   bind :: Bind (GD T m) x (m x)   bind (Lift m) c = m >>= loop . c   bind GetKey  c = unsafePerformIO (liftM (loop . c) createKey)   bind (Split (KeyT m)) c = loop $ c $ loop m+  bind (GDFix f) c = mfix (loop . getKT . f) >>= loop . c    
HMap.cabal view
@@ -1,5 +1,5 @@ Name:                HMap-Version:             1.1.9+Version:             1.2.0 Synopsis:	     Fast heterogeneous maps and unconstrained typeable like functionality. Description:         Fast heterogeneous maps based on Hashmaps and type-able like functionality for type that are not typeable. License:             BSD3