non-empty-zipper 0.1.0.5 → 0.1.0.6
raw patch · 3 files changed
+18/−28 lines, 3 filesPVP: minor bump suggested
API additions: PVP suggests at least a minor version bump
API changes (from Hackage documentation)
+ Data.List.NonEmptyZipper: (|:) :: a -> [a] -> NonEmptyZipper a
+ Data.List.NonEmptyZipper: nezFromBound :: (Bounded a, Enum a, Eq a) => a -> NonEmptyZipper a
+ Data.List.NonEmptyZipper: nezFromOptions :: Eq a => a -> [a] -> Maybe (NonEmptyZipper a)
Files
- Data/List/NonEmptyZipper.hs +17/−0
- default.nix +0/−27
- non-empty-zipper.cabal +1/−1
Data/List/NonEmptyZipper.hs view
@@ -38,6 +38,23 @@ -- ^ A list of element succeeding the current element. deriving (Show, Eq, Ord) +-- | Make a NonEmptyZipper from a focus item (which will be the head) and ADDITIONAL options.+(|:) :: a -> [a] -> NonEmptyZipper a+(|:) = NonEmptyZipper []++-- | Create a NonEmptyZipper based on a focused item in a Bounded Enum,+-- index position within the Enum will be maintained.+nezFromBound :: (Bounded a, Enum a, Eq a) => a -> NonEmptyZipper a+nezFromBound x | x == minBound = NonEmptyZipper [] x [succ x..maxBound]+ | x == maxBound = NonEmptyZipper [minBound..pred x] x []+ | otherwise = NonEmptyZipper [minBound..pred x] x [succ x..maxBound]+++-- | Create a @NonEmptyZipper@ by taking a focused element, and list of options+-- If the focused element is not in the list, we get @Nothing@.+nezFromOptions :: Eq a => a -> [a] -> Maybe (NonEmptyZipper a)+nezFromOptions x xs | x `elem` xs = Just $ x |: delete x xs+nezFromOptions _ _ = Nothing -- | Map to @_before@, useful as a lens before :: Functor f => ([a] -> f [a]) -> NonEmptyZipper a -> f (NonEmptyZipper a)
− default.nix
@@ -1,27 +0,0 @@-{ nixpkgs ? import <nixpkgs> {}, compiler ? "default" }:--let-- inherit (nixpkgs) pkgs;-- f = { mkDerivation, base, checkers, comonad, lens, QuickCheck- , stdenv- }:- mkDerivation {- pname = "non-empty-zipper";- version = "0.1.0.0";- src = ./.;- libraryHaskellDepends = [ base comonad lens ];- testHaskellDepends = [ base checkers comonad lens QuickCheck ];- license = stdenv.lib.licenses.bsd3;- };-- haskellPackages = if compiler == "default"- then pkgs.haskellPackages- else pkgs.haskell.packages.${compiler};-- drv = haskellPackages.callPackage f {};--in-- if pkgs.lib.inNixShell then drv.env else drv
non-empty-zipper.cabal view
@@ -1,5 +1,5 @@ name: non-empty-zipper-version: 0.1.0.5+version: 0.1.0.6 synopsis: The Zipper for NonEmpty description: The Zipper for NonEmpty. Useful for things like tabs, button groups, and slideshows. Basically any case in which