packages feed

predicate-transformers 0.5.0.0 → 0.6.0.0

raw patch · 2 files changed

+16/−4 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ PredicateTransformers: something :: Pred a
+ PredicateTransformers: traceFailure :: Show a => PT a a

Files

predicate-transformers.cabal view
@@ -1,7 +1,7 @@ cabal-version:       2.4  name:                predicate-transformers-version:             0.5.0.0+version:             0.6.0.0 synopsis:            A library for writing predicates and transformations over predicates in Haskell description:   This package provides ways to write predicates such that they compose nicely and are easy to debug.
src/PredicateTransformers.hs view
@@ -72,7 +72,7 @@ only _ _ = False {-# inlinable only #-} --- |Only test the `k`th element of a foldable.+-- |Only test the @k@th element of a foldable. kth :: Foldable f => Int -> PT a (f a) kth k p = startingWith p . drop k . toList {-# inlinable kth #-}@@ -97,7 +97,7 @@ {-# inlinable dist #-}  -- |Given a representable functor-full of predicates, and a functor-full of values,--- yield a representable functor-full of booleans. Similar to `distF`.+-- yield a representable functor-full of booleans. Similar to `dist`. distRep :: Representable f =>     f (a -> Bool) -> f a -> f Bool distRep pr fa = tabulate (\r -> index pr r $ index fa r)@@ -123,7 +123,7 @@ pair f s (a,b) = f a && s b {-# inline conlike pair #-} --- |Flipped function composition; `f !` for a function `f` is a predicate transformer.+-- |Flipped function composition; @f !@ for a function @f@ is a predicate transformer. (!) :: (b -> a) -> (a -> c) -> b -> c (!) = flip (.) {-# inline conlike (!) #-}@@ -131,3 +131,15 @@ -- |Prints the input of a predicate, for debugging. traced :: Show a => (a -> c) -> a -> c traced p a = traceShow a (p a)+{-# inline traced #-}++-- |Prints the input of a predicate, if the predicate fails.+traceFailure :: Show a => PT a a+traceFailure p a = if p a then True else traceShow a False+{-# inline traceFailure #-}++-- |Predicate which always succeeds.+something :: Pred a+something = const True+{-# inline something #-}+