mmsyn5 0.4.2.0 → 0.4.2.1
raw patch · 4 files changed
+23/−16 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- ChangeLog.md +4/−0
- Data/List/InnToOut/Basic.hs +4/−3
- Data/List/InnToOut/Unsafe.hs +14/−12
- mmsyn5.cabal +1/−1
ChangeLog.md view
@@ -67,3 +67,7 @@ * Fourth version revised D. Changed the Data.List.InnToOut.Basic module and the documentation for Data.List.InnToOut.Unsafe module. +## 0.4.2.1 -- 2019-11-13++* Fourth version revised E. Changed the documentation for both modules.+
Data/List/InnToOut/Basic.hs view
@@ -10,17 +10,18 @@ module Data.List.InnToOut.Basic (- -- * Operations to apply a function or different functions (some can create an inner list) to an element of the outer list + -- * Operations to apply a function or two different functions to an element of the outer list (some of them create inner list) mapI , mapI2 ) where --- | Function that applies additional function @f :: a -> [a]@ to @a@ if @p a = True@+-- | Function that applies additional function @f :: a -> [a]@ to @a@ if @p :: a -> Bool@ and @p a = True@ mapI :: (a -> Bool) -> (a -> [a]) -> [a] -> [a] mapI p f = concatMap (\x -> if p x then f x else [x]) {-#INLINE mapI#-} --- | Function that applies additional function @f :: a -> b@ to @a@ if @p a = True@ and otherwise another function @g :: a -> [b]@ to @[a]@ to obtain @[b]@+-- | Function that applies additional function @f :: a -> b@ to @a@ if @p :: a -> Bool@ and @p a = True@ and otherwise another +-- function @g :: a -> [b]@ to @[a]@ and combines results to obtain @[b]@ 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#-}
Data/List/InnToOut/Unsafe.hs view
@@ -5,12 +5,13 @@ -- -- Maintainer : olexandr543@yahoo.com ----- Various additional operations on lists that have additional intermediate Monads inside.+-- Various additional operations on lists that have additional intermediate Monads inside. +-- Like the 'unsafePerformIO' function they can have unpredictable behaviour. Use them ONLY if you surely know what you are doing. -- module Data.List.InnToOut.Unsafe (- -- * Operations to obtain intermediate Monads. Like the 'unsafePerformIO' function they can have unpredictable behaviour. Use them ONLY if you surely know what you are doing.+ -- * Unsafe (in general) operations that can lead to intermediate Monads. unsafeMapI22M ,unsafeMapI2M2 ,unsafeMapI2M2M @@ -18,36 +19,37 @@ ,unsafeMapI2M1 ) where --- | 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 +-- | Unsafe function in which the second intermediate result @c@ is in the @Monad m@. It appears if the predicate @p :: a -> Bool@ is @False@ on @a@.+-- It can have unpredictable behaviour. Use it ONLY if you surely know what you are doing. It's 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#-} --- | 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 +-- | Unsafe function in which the first intermediate result @b@ is in the @Monad m@. It appears if the predicate @p :: a -> Bool@ is @True@ on @a@.+-- It can have unpredictable behaviour. Use it ONLY if you surely know what you are doing. It's 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#-} --- | 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 +-- | Unsafe function in which both the intermediate results @b@ and @c@ are in the Monads. They appear whenever the predicate @p :: a -> Bool@ is @True@ or @False@, but +-- the first one is used if @p a = True@ and the second one -- if @p a = False@.+-- It can have unpredictable behaviour. Use it ONLY if you surely know what you are doing. It's 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#-} --- | 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 +-- | Unsafe function in which the second intermediate result @b@ is in the @Monad m@. It appears if the predicate @p :: a -> Bool@ is @False@ on @a@.+-- It can have unpredictable behaviour. Use it ONLY if you surely know what you are doing. It's 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#-} --- | 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 +-- | Unsafe function in which the first intermediate result @b@ is in the @Monad m@. It appears if the predicate @p :: a -> Bool@ is @True@ on @a@.+-- It can have unpredictable behaviour. Use it ONLY if you surely know what you are doing. It's 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)
mmsyn5.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: mmsyn5-version: 0.4.2.0+version: 0.4.2.1 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