**diff options**

author | OleksandrZhabenko <> | 2019-11-08 14:28:00 (GMT) |
---|---|---|

committer | hdiff <hdiff@hdiff.luite.com> | 2019-11-08 14:28:00 (GMT) |

commit | bfddf0107ac48c1d8e0d387c93acaf952b6515c6 (patch) | |

tree | 1999978d79d5ce48a5e097b8a97eb2f619f9b32f | |

parent | f3f0a76bc04c372d3f7e63275349dd4c3f5d3fb3 (diff) |

version 0.2.3.00.2.3.0

-rw-r--r-- | ChangeLog.md | 4 | ||||

-rw-r--r-- | Data/List/InnToOut.hs | 26 | ||||

-rw-r--r-- | mmsyn5.cabal | 2 |

3 files changed, 26 insertions, 6 deletions

diff --git a/ChangeLog.md b/ChangeLog.md index 1eb787d..648557b 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -38,3 +38,7 @@ ## 0.2.2.1 -- 2019-11-08 * Second version revised C. Fixed documentation. + +## 0.2.3.0 -- 2019-11-08 + +* Second version revised D. Added two new functions (mapI12 and mapI21), renamed the mapI3 to mapI22. diff --git a/Data/List/InnToOut.hs b/Data/List/InnToOut.hs index 0a9c17f..30b89ab 100644 --- a/Data/List/InnToOut.hs +++ b/Data/List/InnToOut.hs @@ -13,7 +13,9 @@ module Data.List.InnToOut -- * Operation to apply a function that creates an inner list to an element of the outer list mapI , mapI2 - , mapI3 + , mapI22 + , mapI12 + , mapI21 ) where -- | Function that applies additional function @f :: a -> [a]@ to @a@ if @p a = True@ @@ -26,7 +28,21 @@ 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@ for the @[a]@. Similar to arrow techniques. -mapI3 :: (a -> Bool) -> (a -> b) -> (b -> d) -> (a -> c) -> (c -> d) -> [a] -> [d] -mapI3 p f1 g f2 h = map (\x -> if p x then g (f1 x) else h (f2 x)) -{-#INLINE mapI3#-} +-- | 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#-} + diff --git a/mmsyn5.cabal b/mmsyn5.cabal index d28425c..09a2c52 100644 --- a/mmsyn5.cabal +++ b/mmsyn5.cabal @@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: mmsyn5 -version: 0.2.2.1 +version: 0.2.3.0 synopsis: Various additional operations on lists description: A small library to deal with a little bit more complex operations on lists than Data.List module homepage: http://hackage.haskell.org/package/mmsyn5 |