promises 0.1 → 0.2
raw patch · 2 files changed
+7/−8 lines, 2 filesdep +primitivedep −monad-st
Dependencies added: primitive
Dependencies removed: monad-st
Files
- promises.cabal +3/−3
- src/Data/Promise.hs +4/−5
promises.cabal view
@@ -1,6 +1,6 @@ name: promises category: Lazy, Concurrent-version: 0.1+version: 0.2 license: BSD3 cabal-version: >= 1.10 license-file: LICENSE@@ -34,5 +34,5 @@ Data.Promise build-depends:- base >= 4.7 && < 5,- monad-st >= 0.2.4 && < 1+ base >= 4.7 && < 5,+ primitive >= 0.6 && < 1
src/Data/Promise.hs view
@@ -40,13 +40,12 @@ import Control.Exception import Control.Monad (ap) import Control.Monad.Fix-import Control.Monad.ST.Class+import Control.Monad.Primitive import Control.Monad.ST.Unsafe import Data.Typeable import System.IO.Unsafe import Unsafe.Coerce - -- | Thrown when the answer for an unfulfillable promise is demanded. data BrokenPromise = BrokenPromise deriving (Show, Typeable) instance Exception BrokenPromise@@ -118,9 +117,9 @@ go (Fulfilled v k) = return $ Fulfilled v (k >>= go) in getLazy m mv >>= go -instance MonadST (Lazy s) where- type World (Lazy s) = s- liftST m = Lazy $ \_ -> Pure <$> unsafeSTToIO m+instance PrimMonad (Lazy s) where+ type PrimState (Lazy s) = s+ primitive m = Lazy $ \_ -> Pure <$> unsafeSTToIO (primitive m) instance MonadFix (Lazy s) where mfix f = do