cflp 0.2.0 → 0.2.1
raw patch · 2 files changed
+17/−3 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- cflp.cabal +1/−1
- src/Data/LazyNondet/Primitive.lhs +16/−2
cflp.cabal view
@@ -1,5 +1,5 @@ Name: cflp-Version: 0.2.0+Version: 0.2.1 Cabal-Version: >= 1.2 Synopsis: Constraint Functional-Logic Programming in Haskell Description: This package provides combinators for constraint
src/Data/LazyNondet/Primitive.lhs view
@@ -103,8 +103,8 @@ > prim_eq :: MonadSolve cs m m > => Untyped cs m -> Untyped cs m -> StateT cs m Bool > prim_eq x y = do-> Cons _ ix xs <- solve x-> Cons _ iy ys <- solve y+> Cons _ ix xs <- solveCons x+> Cons _ iy ys <- solveCons y > if ix==iy then all_eq xs ys else return False > where > all_eq [] [] = return True@@ -116,3 +116,17 @@ We provide a generic comparison function for untyped non-deterministic data that is used to define a typed equality test in the `Data.LazyNondet.Bool` module.++> solveCons :: MonadSolve cs m m+> => Untyped cs m -> StateT cs m (HeadNormalForm cs m)+> solveCons x = do+> hnf <- solve x+> case hnf of+> FreeVar _ y -> solveCons y+> Delayed res -> get >>= solveCons . res+> _ -> return hnf++The function `solveCons` is like `solve` but always yields a+constructor-rooted term, i.e., no free variable or delayed+computation.+