mmsyn5 0.4.1.1 → 0.4.2.0
raw patch · 4 files changed
+19/−28 lines, 4 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Data.List.InnToOut.Basic: mapI12 :: (a -> Bool) -> (a -> c) -> (a -> b) -> (b -> c) -> [a] -> [c]
- Data.List.InnToOut.Basic: mapI21 :: (a -> Bool) -> (a -> b) -> (b -> c) -> (a -> c) -> [a] -> [c]
- Data.List.InnToOut.Basic: mapI22 :: (a -> Bool) -> (a -> b) -> (b -> d) -> (a -> c) -> (c -> d) -> [a] -> [d]
Files
- ChangeLog.md +3/−0
- Data/List/InnToOut/Basic.hs +0/−22
- Data/List/InnToOut/Unsafe.hs +15/−5
- mmsyn5.cabal +1/−1
ChangeLog.md view
@@ -63,4 +63,7 @@ * Fourth version revised C. Some minor changes to .cabal file. +## 0.4.2.0 -- 2019-11-09++* Fourth version revised D. Changed the Data.List.InnToOut.Basic module and the documentation for Data.List.InnToOut.Unsafe module.
Data/List/InnToOut/Basic.hs view
@@ -13,9 +13,6 @@ -- * Operations to apply a function or different functions (some can create an inner list) to an element of the outer list mapI , mapI2- , mapI22- , mapI12- , mapI21 ) where -- | Function that applies additional function @f :: a -> [a]@ to @a@ if @p a = True@@@ -27,23 +24,4 @@ mapI2 :: (a -> Bool) -> (a -> b) -> (a -> [b]) -> [a] -> [b] mapI2 p f g = concatMap (\x -> if p x then [f x] else g x) {-#INLINE mapI2#-}---- | Function that can apply two different ways of computing something depending of the predicate value @p :: a -> Bool@ and the structure of transition the data for the @[a]@. --- It is used if there are two ways to transform data both of them consists of two applied functoins. Similar to arrow techniques.-mapI22 :: (a -> Bool) -> (a -> b) -> (b -> d) -> (a -> c) -> (c -> d) -> [a] -> [d]-mapI22 p f1 g f2 h = map (\x -> if p x then g (f1 x) else h (f2 x)) -{-#INLINE mapI22#-}---- | Function that can apply two different ways of computing something depending of the predicate value @p :: a -> Bool@ and the structure of transition the data for the @[a]@. --- It is used if there are two ways to transform data and the first one consists of one function and another -- from two applied consequently ones. Similar to arrow techniques.-mapI12 :: (a -> Bool) -> (a -> c) -> (a -> b) -> (b -> c) -> [a] -> [c]-mapI12 p f g h = map (\x -> if p x then f x else h (g x)) -{-#INLINE mapI12#-}---- | Function that can apply two different ways of computing something depending of the predicate value @p :: a -> Bool@ and the structure of transition the data for the @[a]@. --- It is used if there are two ways to transform data and the first one consists of two applied consequently functions and the second -- from one applied function. Similar to arrow techniques.-mapI21 :: (a -> Bool) -> (a -> b) -> (b -> c) -> (a -> c) -> [a] -> [c]-mapI21 p f g h = map (\x -> if p x then g (f x) else h x) -{-#INLINE mapI21#-}-
Data/List/InnToOut/Unsafe.hs view
@@ -18,27 +18,37 @@ ,unsafeMapI2M1 ) where --- | Variant of the function 'Data.List.InnToOut.Basic.mapI22' in which the second intermediate result @c@ is in the @Monad m@.+-- | Unsafe function in which the second intermediate result @c@ is in the @Monad m@. +-- It can have unpredictable behaviour. Use it ONLY if you surely know what you are doing. Its your responsibility to check whether +-- the code does what you expect. unsafeMapI22M :: Monad m => (a -> Bool) -> (a -> b) -> (b -> d) -> (a -> m c) -> (m c -> d) -> [a] -> [d] unsafeMapI22M p f1 g f2 h = map (\x -> if p x then g (f1 x) else h (f2 x)) {-#INLINE unsafeMapI22M#-} --- | Variant of the function 'Data.List.InnToOut.Basic.mapI22' in which the first intermediate result @b@ is in the @Monad m@.+-- | Unsafe function in which the first intermediate result @b@ is in the @Monad m@. +-- It can have unpredictable behaviour. Use it ONLY if you surely know what you are doing. Its your responsibility to check whether +-- the code does what you expect. unsafeMapI2M2 :: Monad m => (a -> Bool) -> (a -> m b) -> (m b -> d) -> (a -> c) -> (c -> d) -> [a] -> [d] unsafeMapI2M2 p f1 g f2 h = map (\x -> if p x then g (f1 x) else h (f2 x)) {-#INLINE unsafeMapI2M2#-} --- | Variant of the function 'Data.List.InnToOut.Basic.mapI22' in which both the intermediate results @b@ and @c@ are in the Monads.+-- | Unsafe function in which both the intermediate results @b@ and @c@ are in the Monads. +-- It can have unpredictable behaviour. Use it ONLY if you surely know what you are doing. Its your responsibility to check whether +-- the code does what you expect. unsafeMapI2M2M :: (Monad m0, Monad m) => (a -> Bool) -> (a -> m0 b) -> (m0 b -> d) -> (a -> m c) -> (m c -> d) -> [a] -> [d] unsafeMapI2M2M p f1 g f2 h = map (\x -> if p x then g (f1 x) else h (f2 x)) {-#INLINE unsafeMapI2M2M#-} --- | Variant of the function 'Data.List.InnToOut.Basic.mapI12' in which the second intermediate result @b@ is in the @Monad m@.+-- | Unsafe function in which the second intermediate result @b@ is in the @Monad m@. +-- It can have unpredictable behaviour. Use it ONLY if you surely know what you are doing. Its your responsibility to check whether +-- the code does what you expect. unsafeMapI12M :: Monad m => (a -> Bool) -> (a -> c) -> (a -> m b) -> (m b -> c) -> [a] -> [c] unsafeMapI12M p f g h = map (\x -> if p x then f x else h (g x)) {-#INLINE unsafeMapI12M#-} --- | Variant of the function 'Data.List.InnToOut.Basic.mapI21' in which the first intermediate result @b@ is in the @Monad m@.+-- | Unsafe function in which the first intermediate result @b@ is in the @Monad m@. +-- It can have unpredictable behaviour. Use it ONLY if you surely know what you are doing. Its your responsibility to check whether +-- the code does what you expect. unsafeMapI2M1 :: Monad m => (a -> Bool) -> (a -> m b) -> (m b -> c) -> (a -> c) -> [a] -> [c] unsafeMapI2M1 p f g h = map (\x -> if p x then g (f x) else h x) {-#INLINE unsafeMapI2M1#-}
mmsyn5.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: mmsyn5-version: 0.4.1.1+version: 0.4.2.0 synopsis: Various additional operations on lists (some with intermediate Monads) description: A small library to deal with a little bit more complex operations on lists than Data.List module homepage: https://hackage.haskell.org/package/mmsyn5