unique-logic-tf 0.4.0.1 → 0.4.1
raw patch · 2 files changed
+19/−7 lines, 2 files
Files
- src/UniqueLogic/ST/TF/System.hs +17/−5
- unique-logic-tf.cabal +2/−2
src/UniqueLogic/ST/TF/System.hs view
@@ -18,7 +18,7 @@ constant, assignment2, assignment3,- Apply, arg, runApply,+ Apply, arg, runApply, runApplyMaybe, -- * Solution solve, solveDepthFirst, solveBreadthFirst, query,@@ -34,7 +34,7 @@ import Control.Monad.Trans.Maybe (MaybeT(MaybeT), runMaybeT, mapMaybeT, ) import Control.Monad.Trans.Identity (IdentityT, ) import Control.Monad.ST (ST, )-import Control.Monad (when, liftM2, ap, guard, )+import Control.Monad (when, liftM2, ap, guard, join, ) import Control.Applicative (Applicative, pure, (<*>), ) import Data.Sequence (Seq, (|>), ViewL((:<)), ) import Data.Functor.Compose (Compose(Compose))@@ -261,7 +261,7 @@ -} arg :: Variable w s a -> Apply w s a arg (Variable _update al av) =- Apply $ Compose $ MW.writer (MaybeT $ readSTRef av, [al])+ Apply $ Compose $ MW.writer (readSTRefM av, [al]) instance Functor (Apply w s) where fmap f (Apply a) = Apply $ fmap f a@@ -275,6 +275,18 @@ UMT.C w => Apply w s a -> Variable w s a -> T w s () runApply (Apply (Compose w)) a =+ uncurry (runUpdate a) $ MW.runWriter w++runApplyMaybe ::+ UMT.C w =>+ Apply w s (Maybe a) -> Variable w s a -> T w s ()+runApplyMaybe (Apply (Compose w)) a = case MW.runWriter w of- (f, refs) ->- lift $ Fold.forM_ refs $ flip modifySTRef (addUpdate $ varUpdate a f)+ (mf, refs) ->+ runUpdate a (MaybeT $ fmap join $ runMaybeT mf) refs++runUpdate ::+ Variable w s a -> MaybeT (ST s) a ->+ [STRef s (Updates w s)] -> T w s ()+runUpdate a f refs =+ lift $ Fold.forM_ refs $ flip modifySTRef (addUpdate $ varUpdate a f)
unique-logic-tf.cabal view
@@ -1,5 +1,5 @@ Name: unique-logic-tf-Version: 0.4.0.1+Version: 0.4.1 License: BSD3 License-File: LICENSE Author: Henning Thielemann@@ -64,7 +64,7 @@ Build-Type: Simple Source-Repository this- Tag: 0.4.0.1+ Tag: 0.4.1 Type: darcs Location: http://code.haskell.org/~thielema/unique-logic-tf/