sublists 0.1.0.2 → 0.1.1.0
raw patch · 3 files changed
+20/−2 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Sublists: intoRegularSublistsA :: Applicative f => (a -> f [Int]) -> a -> [b] -> f [[b]]
Files
- ChangeLog.md +4/−0
- Sublists.hs +14/−0
- sublists.cabal +2/−2
ChangeLog.md view
@@ -12,3 +12,7 @@ * First version revised B. Fixed issues with the documentation. +## 0.1.1.0 -- 2021-03-05++* First version revised C. Added variant of the Applicative usage.+
Sublists.hs view
@@ -9,6 +9,9 @@ module Sublists where +import Control.Applicative (Applicative,pure,(<*>))+import Data.Functor ((<$>))+ {-| Splits the input second argument into sublists each one containing the @n@ elements where the number is taken as the sequential element in the first argument starting from the left to the right. If the number is less than 1 then the corresponding sublist is empty. If all the elements in the first argument are less than 1 then returns an infinite lazy list of@@ -40,3 +43,14 @@ | null xs = return [] | otherwise = f seed >>= \ns -> return . intoRegularSublists ns $ xs {-# INLINABLE intoRegularSublistsM #-}++{-| An 'Applicative' variant of the 'intoRegularSublists' where the first argument is taken from the applicative function. -}+intoRegularSublistsA :: (Applicative f)+ => (a -> f [Int]) -- ^ An 'Applicative' function to obtain the argument for the regularization.+ -> a -- ^ An initial element (seed) for the applicative function.+ -> [b] -- ^ A list to be splitted into the sublists.+ -> f [[b]]+intoRegularSublistsA f seed xs+ | null xs = pure []+ | otherwise = (\ns xs -> intoRegularSublists ns xs) <$> f seed <*> pure xs+{-# INLINABLE intoRegularSublistsA #-}
sublists.cabal view
@@ -2,9 +2,9 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: sublists-version: 0.1.0.2+version: 0.1.1.0 synopsis: Allows to split lists into sublists with some patterns by quantity.-description: These patterns can be a list of numbers or obtained from the monadic function. Leads to somewhat cycling or regularized structures from the length perspective (these ones can be transformed into other variativity types).+description: These patterns can be a list of numbers, or obtained from the monadic or applicative function. Leads to somewhat cycling or regularized structures from the length perspective (these ones can be transformed into other variativity types). homepage: https://hackage.haskell.org/package/sublists license: MIT license-file: LICENSE