non-empty 0.3.0.1 → 0.3.1
raw patch · 5 files changed
+52/−8 lines, 5 filesdep ~containersPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: containers
API changes (from Hackage documentation)
- Data.NonEmpty.Class: instance Data.NonEmpty.Class.Empty GHC.Base.Maybe
- Data.NonEmpty.Class: instance Data.NonEmpty.Class.Iterate GHC.Base.Maybe
- Data.NonEmpty.Class: instance Data.NonEmpty.Class.NFData GHC.Base.Maybe
- Data.NonEmpty.Class: instance Data.NonEmpty.Class.Repeat GHC.Base.Maybe
- Data.NonEmpty.Class: instance Data.NonEmpty.Class.Reverse GHC.Base.Maybe
- Data.NonEmpty.Class: instance Data.NonEmpty.Class.Singleton GHC.Base.Maybe
- Data.NonEmpty.Class: instance Data.NonEmpty.Class.Sort GHC.Base.Maybe
- Data.NonEmpty.Class: instance Data.NonEmpty.Class.SortBy GHC.Base.Maybe
- Data.NonEmpty.Class: instance Data.NonEmpty.Class.View GHC.Base.Maybe
- Data.NonEmpty.Class: instance Data.NonEmpty.Class.ViewL GHC.Base.Maybe
- Data.NonEmpty.Class: instance Data.NonEmpty.Class.ViewR GHC.Base.Maybe
- Data.NonEmpty.Class: instance Data.NonEmpty.Class.Zip GHC.Base.Maybe
+ Data.Empty: instance Data.NonEmpty.Class.Arbitrary Data.Empty.T
+ Data.Empty: instance Data.NonEmpty.Class.Gen Data.Empty.T
+ Data.NonEmpty.Class: class (Arbitrary f) => Gen f
+ Data.NonEmpty.Class: genOf :: Gen f => Gen a -> Gen (f a)
+ Data.NonEmpty.Class: infixr 5 `append`
+ Data.NonEmpty.Class: instance Data.NonEmpty.Class.Arbitrary GHC.Maybe.Maybe
+ Data.NonEmpty.Class: instance Data.NonEmpty.Class.Empty GHC.Maybe.Maybe
+ Data.NonEmpty.Class: instance Data.NonEmpty.Class.Gen GHC.Maybe.Maybe
+ Data.NonEmpty.Class: instance Data.NonEmpty.Class.Gen []
+ Data.NonEmpty.Class: instance Data.NonEmpty.Class.Iterate GHC.Maybe.Maybe
+ Data.NonEmpty.Class: instance Data.NonEmpty.Class.NFData GHC.Maybe.Maybe
+ Data.NonEmpty.Class: instance Data.NonEmpty.Class.Repeat GHC.Maybe.Maybe
+ Data.NonEmpty.Class: instance Data.NonEmpty.Class.Reverse GHC.Maybe.Maybe
+ Data.NonEmpty.Class: instance Data.NonEmpty.Class.Singleton GHC.Maybe.Maybe
+ Data.NonEmpty.Class: instance Data.NonEmpty.Class.Sort GHC.Maybe.Maybe
+ Data.NonEmpty.Class: instance Data.NonEmpty.Class.SortBy GHC.Maybe.Maybe
+ Data.NonEmpty.Class: instance Data.NonEmpty.Class.View GHC.Maybe.Maybe
+ Data.NonEmpty.Class: instance Data.NonEmpty.Class.ViewL GHC.Maybe.Maybe
+ Data.NonEmpty.Class: instance Data.NonEmpty.Class.ViewR GHC.Maybe.Maybe
+ Data.NonEmpty.Class: instance Data.NonEmpty.Class.Zip GHC.Maybe.Maybe
+ Data.Optional: instance Data.NonEmpty.Class.Arbitrary f => Data.NonEmpty.Class.Arbitrary (Data.Optional.T f)
+ Data.Optional: instance Data.NonEmpty.Class.Gen f => Data.NonEmpty.Class.Gen (Data.Optional.T f)
- Data.NonEmpty: appendRight :: (Append f) => T f a -> f a -> T f a
+ Data.NonEmpty: appendRight :: Append f => T f a -> f a -> T f a
- Data.NonEmpty: foldl1 :: (Foldable f) => (a -> a -> a) -> T f a -> a
+ Data.NonEmpty: foldl1 :: Foldable f => (a -> a -> a) -> T f a -> a
- Data.NonEmpty: foldl1Map :: (Foldable f) => (b -> b -> b) -> (a -> b) -> T f a -> b
+ Data.NonEmpty: foldl1Map :: Foldable f => (b -> b -> b) -> (a -> b) -> T f a -> b
- Data.NonEmpty: init :: (Traversable f) => T f a -> f a
+ Data.NonEmpty: init :: Traversable f => T f a -> f a
- Data.NonEmpty: insert :: (Insert f, (Ord a)) => a -> f a -> T f a
+ Data.NonEmpty: insert :: (Insert f, Ord a) => a -> f a -> T f a
- Data.NonEmpty: last :: (Foldable f) => T f a -> a
+ Data.NonEmpty: last :: Foldable f => T f a -> a
- Data.NonEmpty: mapAdjacent :: (Traversable f) => (a -> a -> b) -> T f a -> f b
+ Data.NonEmpty: mapAdjacent :: Traversable f => (a -> a -> b) -> T f a -> f b
- Data.NonEmpty: maximumBy :: (Foldable f) => (a -> a -> Ordering) -> T f a -> a
+ Data.NonEmpty: maximumBy :: Foldable f => (a -> a -> Ordering) -> T f a -> a
- Data.NonEmpty: minimumBy :: (Foldable f) => (a -> a -> Ordering) -> T f a -> a
+ Data.NonEmpty: minimumBy :: Foldable f => (a -> a -> Ordering) -> T f a -> a
- Data.NonEmpty: removeEach :: (Traversable f) => T f a -> T f (a, f a)
+ Data.NonEmpty: removeEach :: Traversable f => T f a -> T f (a, f a)
- Data.NonEmpty: viewR :: (Traversable f) => T f a -> (f a, a)
+ Data.NonEmpty: viewR :: Traversable f => T f a -> (f a, a)
- Data.NonEmpty: zipWith :: (Zip f) => (a -> b -> c) -> T f a -> T f b -> T f c
+ Data.NonEmpty: zipWith :: Zip f => (a -> b -> c) -> T f a -> T f b -> T f c
- Data.NonEmpty.Class: sort :: (Sort f, (Ord a)) => f a -> f a
+ Data.NonEmpty.Class: sort :: (Sort f, Ord a) => f a -> f a
- Data.NonEmpty.Class: zip :: (Zip f) => f a -> f b -> f (a, b)
+ Data.NonEmpty.Class: zip :: Zip f => f a -> f b -> f (a, b)
- Data.NonEmpty.Class: zip3 :: (Zip f) => f a -> f b -> f c -> f (a, b, c)
+ Data.NonEmpty.Class: zip3 :: Zip f => f a -> f b -> f c -> f (a, b, c)
- Data.NonEmpty.Class: zip4 :: (Zip f) => f a -> f b -> f c -> f d -> f (a, b, c, d)
+ Data.NonEmpty.Class: zip4 :: Zip f => f a -> f b -> f c -> f d -> f (a, b, c, d)
- Data.NonEmpty.Class: zipWith3 :: (Zip f) => (a -> b -> c -> d) -> f a -> f b -> f c -> f d
+ Data.NonEmpty.Class: zipWith3 :: Zip f => (a -> b -> c -> d) -> f a -> f b -> f c -> f d
- Data.NonEmpty.Class: zipWith4 :: (Zip f) => (a -> b -> c -> d -> e) -> f a -> f b -> f c -> f d -> f e
+ Data.NonEmpty.Class: zipWith4 :: Zip f => (a -> b -> c -> d -> e) -> f a -> f b -> f c -> f d -> f e
- Data.NonEmpty.Map: fetch :: (Ord k) => Map k a -> Maybe (T k a)
+ Data.NonEmpty.Map: fetch :: Ord k => Map k a -> Maybe (T k a)
- Data.NonEmpty.Map: flatten :: (Ord k) => T k a -> Map k a
+ Data.NonEmpty.Map: flatten :: Ord k => T k a -> Map k a
- Data.NonEmpty.Map: fromList :: (Ord k) => T [] (k, a) -> T k a
+ Data.NonEmpty.Map: fromList :: Ord k => T [] (k, a) -> T k a
- Data.NonEmpty.Map: keysSet :: (Ord k) => T k a -> T k
+ Data.NonEmpty.Map: keysSet :: Ord k => T k a -> T k
- Data.NonEmpty.Map: lookup :: (Ord k) => k -> T k a -> Maybe a
+ Data.NonEmpty.Map: lookup :: Ord k => k -> T k a -> Maybe a
- Data.NonEmpty.Map: map :: (Ord k) => (a -> b) -> T k a -> T k b
+ Data.NonEmpty.Map: map :: Ord k => (a -> b) -> T k a -> T k b
- Data.NonEmpty.Map: mapWithKey :: (Ord k) => (k -> a -> b) -> T k a -> T k b
+ Data.NonEmpty.Map: mapWithKey :: Ord k => (k -> a -> b) -> T k a -> T k b
- Data.NonEmpty.Map: maxViewWithKey :: (Ord k) => T k a -> ((k, a), Map k a)
+ Data.NonEmpty.Map: maxViewWithKey :: Ord k => T k a -> ((k, a), Map k a)
- Data.NonEmpty.Map: member :: (Ord k) => k -> T k a -> Bool
+ Data.NonEmpty.Map: member :: Ord k => k -> T k a -> Bool
- Data.NonEmpty.Map: union :: (Ord k) => T k a -> T k a -> T k a
+ Data.NonEmpty.Map: union :: Ord k => T k a -> T k a -> T k a
- Data.NonEmpty.Map: unionLeft :: (Ord k) => Map k a -> T k a -> T k a
+ Data.NonEmpty.Map: unionLeft :: Ord k => Map k a -> T k a -> T k a
- Data.NonEmpty.Map: unionRight :: (Ord k) => T k a -> Map k a -> T k a
+ Data.NonEmpty.Map: unionRight :: Ord k => T k a -> Map k a -> T k a
- Data.NonEmpty.Match: replicate :: (Functor f) => f a -> b -> f b
+ Data.NonEmpty.Match: replicate :: Functor f => f a -> b -> f b
- Data.NonEmpty.Match: take :: (Zip f) => f b -> f a -> f a
+ Data.NonEmpty.Match: take :: Zip f => f b -> f a -> f a
- Data.NonEmpty.Mixed: appendLeft :: (Cons f) => [a] -> f a -> f a
+ Data.NonEmpty.Mixed: appendLeft :: Cons f => [a] -> f a -> f a
- Data.NonEmpty.Mixed: filterToInfixes :: (Foldable f) => (a -> Bool) -> f a -> [T [] a]
+ Data.NonEmpty.Mixed: filterToInfixes :: Foldable f => (a -> Bool) -> f a -> [T [] a]
- Data.NonEmpty.Mixed: groupBy :: (Foldable f) => (a -> a -> Bool) -> f a -> [T [] a]
+ Data.NonEmpty.Mixed: groupBy :: Foldable f => (a -> a -> Bool) -> f a -> [T [] a]
- Data.NonEmpty.Mixed: groupEithers :: (Foldable f) => f (Either a b) -> [Either (T [] a) (T [] b)]
+ Data.NonEmpty.Mixed: groupEithers :: Foldable f => f (Either a b) -> [Either (T [] a) (T [] b)]
- Data.NonEmpty.Mixed: last :: (ViewR f) => T f a -> a
+ Data.NonEmpty.Mixed: last :: ViewR f => T f a -> a
- Data.NonEmpty.Mixed: segmentAfter :: (Foldable f) => (a -> Bool) -> f a -> ([T [] a], [a])
+ Data.NonEmpty.Mixed: segmentAfter :: Foldable f => (a -> Bool) -> f a -> ([T [] a], [a])
- Data.NonEmpty.Mixed: segmentBefore :: (Foldable f) => (a -> Bool) -> f a -> ([a], [T [] a])
+ Data.NonEmpty.Mixed: segmentBefore :: Foldable f => (a -> Bool) -> f a -> ([a], [T [] a])
- Data.NonEmpty.Set: deleteFindMax :: (Ord a) => T a -> (a, Set a)
+ Data.NonEmpty.Set: deleteFindMax :: Ord a => T a -> (a, Set a)
- Data.NonEmpty.Set: deleteMax :: (Ord a) => T a -> Set a
+ Data.NonEmpty.Set: deleteMax :: Ord a => T a -> Set a
- Data.NonEmpty.Set: fetch :: (Ord a) => Set a -> Maybe (T a)
+ Data.NonEmpty.Set: fetch :: Ord a => Set a -> Maybe (T a)
- Data.NonEmpty.Set: flatten :: (Ord a) => T a -> Set a
+ Data.NonEmpty.Set: flatten :: Ord a => T a -> Set a
- Data.NonEmpty.Set: fromList :: (Ord a) => T [] a -> T a
+ Data.NonEmpty.Set: fromList :: Ord a => T [] a -> T a
- Data.NonEmpty.Set: maxView :: (Ord a) => T a -> (a, Set a)
+ Data.NonEmpty.Set: maxView :: Ord a => T a -> (a, Set a)
- Data.NonEmpty.Set: member :: (Ord a) => a -> T a -> Bool
+ Data.NonEmpty.Set: member :: Ord a => a -> T a -> Bool
- Data.NonEmpty.Set: union :: (Ord a) => T a -> T a -> T a
+ Data.NonEmpty.Set: union :: Ord a => T a -> T a -> T a
- Data.NonEmpty.Set: unionLeft :: (Ord a) => Set a -> T a -> T a
+ Data.NonEmpty.Set: unionLeft :: Ord a => Set a -> T a -> T a
- Data.NonEmpty.Set: unionRight :: (Ord a) => T a -> Set a -> T a
+ Data.NonEmpty.Set: unionRight :: Ord a => T a -> Set a -> T a
- Data.Optional: Cons :: a -> (f a) -> T f a
+ Data.Optional: Cons :: a -> f a -> T f a
Files
- non-empty.cabal +2/−2
- src/Data/Empty.hs +9/−0
- src/Data/NonEmpty/Class.hs +16/−0
- src/Data/NonEmptyPrivate.hs +5/−0
- src/Data/Optional.hs +20/−6
non-empty.cabal view
@@ -1,5 +1,5 @@ Name: non-empty-Version: 0.3.0.1+Version: 0.3.1 License: BSD3 License-File: LICENSE Author: Henning Thielemann <haskell@henning-thielemann.de>@@ -66,7 +66,7 @@ Build-Type: Simple Source-Repository this- Tag: 0.3.0.1+ Tag: 0.3.1 Type: darcs Location: http://hub.darcs.net/thielema/non-empty/
src/Data/Empty.hs view
@@ -36,9 +36,18 @@ instance C.View T where + instance QC.Arbitrary (T a) where arbitrary = return Cons shrink _ = []++instance C.Arbitrary T where+ arbitrary = return Cons+ shrink _ = []++instance C.Gen T where+ genOf _gen = return Cons+ instance C.Empty T where empty = Cons
src/Data/NonEmpty/Class.hs view
@@ -276,6 +276,22 @@ arbitrary = QC.arbitrary shrink = QC.shrink +instance Arbitrary Maybe where+ arbitrary = QC.arbitrary+ shrink = QC.shrink+++class (Arbitrary f) => Gen f where+ genOf :: QC.Gen a -> QC.Gen (f a)++instance Gen [] where+ genOf = QC.listOf++instance Gen Maybe where+ genOf gen = do+ b <- QC.arbitrary+ if b then fmap Just gen else return Nothing+ class NFData f where rnf :: DeepSeq.NFData a => f a -> ()
src/Data/NonEmptyPrivate.hs view
@@ -151,6 +151,11 @@ arbitrary = fmap Aux C.arbitrary shrink (Aux x) = fmap Aux $ C.shrink x ++instance (C.Gen f) => C.Gen (T f) where+ genOf gen = liftA2 Cons gen $ C.genOf gen++ {- | Implementation of 'Applicative.<*>' without the 'C.Empty' constraint that is needed for 'Applicative.pure'.
src/Data/Optional.hs view
@@ -71,13 +71,27 @@ sequenceA Nil = pure Nil sequenceA (Cons x xs) = liftA2 Cons x (Trav.sequenceA xs) + instance (C.Arbitrary f, QC.Arbitrary a) => QC.Arbitrary (T f a) where- arbitrary =- QC.oneof- [return Nil, liftA2 Cons QC.arbitrary C.arbitrary]- shrink Nil = []- shrink (Cons x xs) =- P.map (\(y, Aux ys) -> Cons y ys) (QC.shrink (x, Aux xs))+ arbitrary = arbitrary+ shrink = shrink++instance (C.Arbitrary f) => C.Arbitrary (T f) where+ arbitrary = arbitrary+ shrink = shrink++arbitrary :: (C.Arbitrary f, QC.Arbitrary a) => QC.Gen (T f a)+arbitrary = QC.oneof [return Nil, liftA2 Cons QC.arbitrary C.arbitrary]++shrink :: (C.Arbitrary f, QC.Arbitrary a) => T f a -> [T f a]+shrink Nil = []+shrink (Cons x xs) = P.map (\(y, Aux ys) -> Cons y ys) (QC.shrink (x, Aux xs))++instance (C.Gen f) => C.Gen (T f) where+ genOf gen = do+ b <- QC.arbitrary+ if b then liftA2 Cons gen $ C.genOf gen else return Nil+ instance C.Empty (T f) where empty = Nil