packages feed

either-list-functions 0.0.0.3 → 0.0.2.0

raw patch · 3 files changed

+25/−6 lines, 3 filesdep ~basePVP ok

version bump matches the API change (PVP)

Dependency ranges changed: base

API changes (from Hackage documentation)

+ Data.List.EitherFunctions: partition :: [Either a b] -> ([a], [b])

Files

+ changelog.txt view
@@ -0,0 +1,3 @@+0.0.2.0+  - Supports base-4.12+  - Added 'partition' function
either-list-functions.cabal view
@@ -1,5 +1,5 @@ name:     either-list-functions-version:  0.0.0.3+version:  0.0.2.0 category: Data synopsis: Functions involving lists of Either @@ -17,6 +17,9 @@ build-type: Simple cabal-version: >= 1.10 +extra-source-files:+  changelog.txt+ source-repository head   type: git   location: https://github.com/chris-martin/either-list-functions@@ -27,7 +30,7 @@   ghc-options: -Wall    build-depends:-      base >=4.9 && <4.12+      base >=4.9 && <4.13    exposed-modules:       Data.List.EitherFunctions@@ -40,6 +43,6 @@   hs-source-dirs: test    build-depends:-      base >=4.9 && <4.12+      base >=4.9 && <4.13     , doctest     , either-list-functions
src/Data/List/EitherFunctions.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE LambdaCase        #-} {-# LANGUAGE NoImplicitPrelude #-}  module Data.List.EitherFunctions@@ -6,12 +5,14 @@   , groupEither   , spanLeft   , spanRight+  , partition   ) where  import Data.Either (Either (..))-import Data.List   (map) import Data.Maybe  (Maybe (..), maybe) +import qualified Data.List as List+ {- |  >>> import Prelude (even, show)@@ -21,7 +22,7 @@  -} partlyMap :: (a -> Maybe b) -> [a] -> [Either a b]-partlyMap f = map (\x -> maybe (Left x) Right (f x))+partlyMap f = List.map (\x -> maybe (Left x) Right (f x))  {- | @@ -65,3 +66,15 @@ spanRight ((Right x) : xs) = let (ys, zs) = spanRight xs                              in  (x : ys, zs) spanRight xs = ([], xs)++{- |++>>> partition [Left 1, Left 2, Right 'a', Left 3, Right 'b', Right 'c']+([1,2,3],"abc")++-}+partition :: [Either a b] -> ([a], [b])+partition [] = ([], [])+partition (x : xs) = let (as, bs) = partition xs+                     in  case x of Left a  -> (a : as, bs)+                                   Right b -> (as, b : bs)