@@ -21,7 +21,6 @@ module Duct.Context
2121 )
2222where
2323
24−import Control.Applicative (Alternative(..))
2524import Control.Concurrent (ThreadId)
2625import Control.Concurrent.STM (TChan)
2726import Control.Exception (SomeException)
@@ -29,7 +28,7 @@ import Control.Monad.State (MonadState, gets, modify, StateT,
2928 MonadPlus(..), MonadIO(..))
3029import qualified Control.Monad.Trans.State.Lazy as Lazy (get, gets, modify, put)
3130import Data.Dynamic (TypeRep, Typeable, typeOf)
32−import Data.IORef (IORef, modifyIORef)
31+import Data.IORef (IORef)
3332import qualified Data.Map as M
3433import Unsafe.Coerce (unsafeCoerce)
3534import GHC.Prim (Any)
@@ -162,14 +161,13 @@ saveContext m f =
162161
163162-- pop the top function from the continuation stack, create the next closure,
164163-- set it as the current closure and return it.
165−restoreContext :: (Alternative f, Monad m) => Maybe a -> StateT Context m (f b)
164+restoreContext :: (MonadPlus m1, Monad m) => Maybe a -> StateT Context m (m1 b)
166165restoreContext x = do
167166 -- XXX fstack must be non-empty when this is called.
168167 ctx@Context { fstack = f:fs } <- Lazy.get
169168
170169 let mres = case x of
171− -- XXX use mzero instead
172− Nothing -> empty
170+ Nothing -> mzero
173171 Just y -> (unsafeCoerce f) y
174172
175173 Lazy.put ctx { currentm = unsafeCoerce mres, fstack = fs }