uniform-pair 0.1.5 → 0.1.6
raw patch · 3 files changed
+19/−2 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Data.UniformPair: updateP :: Bool -> (a -> a) -> Pair a -> Pair a
Files
- changelog +4/−0
- src/Data/UniformPair.hs +14/−1
- uniform-pair.cabal +1/−1
changelog view
@@ -1,3 +1,7 @@+0.1.5:++* Derives Eq & Ord. Thanks to George Wilson.+ 0.1.4: * Added changelog
src/Data/UniformPair.hs view
@@ -15,7 +15,9 @@ -- morphism principle. ---------------------------------------------------------------------- -module Data.UniformPair (Pair(..), fstP,sndP, firstP, secondP, compareSwap) where+module Data.UniformPair+ ( Pair(..), fstP,sndP, firstP, secondP, updateP, compareSwap+ ) where import Data.Monoid (Monoid(..),(<>)) import Data.Functor ((<$>))@@ -70,6 +72,17 @@ -- where -- (c :# _) = f a -- (_ :# d) = f b++-- Update a component, indexing by 'False' for the first element and 'True' for+-- the second.+updateP :: Bool -> (a -> a) -> Pair a -> Pair a+updateP False f (a :# b) = f a :# b+updateP True f (a :# b) = a :# f b++-- -- Untrie. What argument order do I want here?+-- getP :: Pair a -> Bool -> a+-- getP (a :# _) False = a+-- getP (_ :# b) True = b -- Compare and swap compareSwap :: Ord a => Pair a -> Pair a
uniform-pair.cabal view
@@ -1,5 +1,5 @@ Name: uniform-pair-Version: 0.1.5+Version: 0.1.6 Cabal-Version: >= 1.6 Synopsis: Uniform pairs with class instances Category: Data