packages feed

unique-logic-tf 0.5.1.1 → 0.5.1.2

raw patch · 3 files changed

+28/−20 lines, 3 filesdep ~semigroups

Dependency ranges changed: semigroups

Files

src/UniqueLogic/ST/TF/Example/Verify.hs view
@@ -43,7 +43,10 @@ tn1 :: (Term.T -> Term.T) -> (a -> b) -> TrackedNumber a -> TrackedNumber b tn1 f g (TrackedNumber xt xn) = TrackedNumber (f xt) (g xn) -tn2 :: (Term.T -> Term.T -> Term.T) -> (a -> b -> c) -> TrackedNumber a -> TrackedNumber b -> TrackedNumber c+tn2 ::+   (Term.T -> Term.T -> Term.T) ->+   (a -> b -> c) ->+   TrackedNumber a -> TrackedNumber b -> TrackedNumber c tn2 f g (TrackedNumber xt xn) (TrackedNumber yt yn) =    TrackedNumber (f xt yt) (g xn yn) @@ -104,7 +107,8 @@          VerifyConstraint ->             Sys.updateAndCheck                (\old new ->-                  inconsistency Nothing (toTrackedNumber old) (toTrackedNumber new))+                  inconsistency Nothing+                     (toTrackedNumber old) (toTrackedNumber new))                al av act  @@ -114,7 +118,8 @@  data    Exception =-      Exception (Maybe Term.Name) (TrackedNumber Rational) (TrackedNumber Rational)+      Exception (Maybe Term.Name)+         (TrackedNumber Rational) (TrackedNumber Rational)    deriving (Show)  type Variable s = Sys.Variable Track s (TrackedNumber Rational)@@ -122,7 +127,8 @@ globalVariable :: (Ref.C s) => Term.Name -> s (Variable s) globalVariable name =    Sys.globalVariable-      (\al av -> Sys.updateAndCheck (inconsistency $ Just name) al av . logUpdate name)+      (\al av ->+         Sys.updateAndCheck (inconsistency $ Just name) al av . logUpdate name)   match :: (Eq a) => TrackedNumber a -> TrackedNumber a -> Bool@@ -146,7 +152,8 @@ logUpdate name act = do    tn@(TrackedNumber _ x) <- mapMaybeT UMT.lift act    MT.lift $ UMT.wrap $ Track $ MT.lift $-      writer (TrackedNumber (Term.Var name) x, [Assign name $ fmap toRational tn])+      writer (TrackedNumber (Term.Var name) x,+                  [Assign name $ fmap toRational tn])   example ::@@ -164,7 +171,6 @@                 y = Expr.fromVariable yv             x*3 =:= y/2             5 =:= 2+x---            4 =:= 2+x          MT.lift $ liftM2 (,)             (Sys.query xv)             (Sys.query yv))
src/UniqueLogic/ST/TF/System.hs view
@@ -70,12 +70,12 @@   type Updater w s a =-        Ref.T s (Updates w s) -> Ref.T s (Maybe a) ->-        MaybeT (UMT.Wrap w s) a -> Update w s+      Ref.T s (Updates w s) -> Ref.T s (Maybe a) ->+      MaybeT (UMT.Wrap w s) a -> Update w s  type SimpleUpdater w s a =-        Ref.T s (Updates w s) -> Ref.T s (Maybe a) ->-        MaybeT s a -> Update w s+      Ref.T s (Updates w s) -> Ref.T s (Maybe a) ->+      MaybeT s a -> Update w s  newtype T w s a =    Cons {run :: WriterT [Ref.T s (Updates w s)] s a}@@ -98,7 +98,7 @@ globalVariable ::    (UMT.C w, Value w a, Ref.C s) =>    SimpleUpdater w s a -> s (Variable w s a)-globalVariable triggerUpdate = object triggerUpdate Nothing+globalVariable updater = object updater Nothing  localVariable :: (C w, Value w a, Ref.C s) => T w s (Variable w s a) localVariable = lift $ globalVariable simpleUpdate@@ -238,8 +238,7 @@    Variable w s a -> Variable w s b ->    T w s () assignment2 f (Variable _ al av) b =-   let triggerUpdate =-          varUpdate b $ liftM f $ readSTRefM av+   let triggerUpdate = varUpdate b $ liftM f $ readSTRefM av    in  lift $        Ref.modify al (addUpdate triggerUpdate) @@ -252,9 +251,7 @@    Variable w s a -> Variable w s b -> Variable w s c ->    T w s () assignment3 f (Variable _ al av) (Variable _ bl bv) c =-   let triggerUpdate =-          varUpdate c $-          liftM2 f (readSTRefM av) (readSTRefM bv)+   let triggerUpdate = varUpdate c $ liftM2 f (readSTRefM av) (readSTRefM bv)    in  lift $        Ref.modify al (addUpdate triggerUpdate) >>        Ref.modify bl (addUpdate triggerUpdate)
unique-logic-tf.cabal view
@@ -1,6 +1,6 @@ Cabal-Version:    2.2 Name:             unique-logic-tf-Version:          0.5.1.1+Version:          0.5.1.2 License:          BSD-3-Clause License-File:     LICENSE Author:           Henning Thielemann@@ -10,7 +10,7 @@ Synopsis:         Solve simple simultaneous equations Description:   Solve a number of equations simultaneously.-  This is not Computer Algebra,+  This is not Computer Algebra nor SMT solving,   better think of a kind of type inference algorithm   or logic programming with only one allowed solution.   .@@ -60,13 +60,18 @@     We demonstrate that in "UniqueLogic.ST.TF.Example.Verify".   .   This variant of the package requires type families.+  This helps us avoid @Duplicate@ constraints on the variable values,+  for the cases where there are no duplication checks.+  .+  The concept seems to be formerly known as+  <https://en.wikipedia.org/wiki/Dataflow_language>. Tested-With:       GHC==7.4.2 Build-Type:        Simple Extra-Doc-Files:   Changes.md  Source-Repository this-  Tag:         0.5.1.1+  Tag:         0.5.1.2   Type:        darcs   Location:    https://hub.darcs.net/thielema/unique-logic-tf/ @@ -78,7 +83,7 @@   Build-Depends:     data-ref >=0.0 && <0.2,     transformers >=0.4 && <0.7,-    semigroups >=0.1 && <1.0,+    semigroups >=0.1 && <1,     containers >=0.4 && <0.9,     utility-ht >=0.0.9 && <0.1,     base >= 4 && <5