packages feed

halfsplit 0.3.0.0 → 0.4.0.0

raw patch · 4 files changed

+34/−6 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Phladiprelio.Halfsplit: halfsplit1G :: (Show a, Eq b) => (a -> b) -> String -> Int8 -> [a] -> String
+ Phladiprelio.Halfsplit: halfsplit2G :: (Show a, Eq b) => (a -> b) -> String -> String -> String -> Int8 -> [a] -> String

Files

CHANGELOG.md view
@@ -12,3 +12,7 @@  * Trird version. Added a new function print23. +## 0.4.0.0 -- 2023-11-06++* Fourth version. Added new functions halfsplit1G and halfsplit2G to extend the functionality.+
Phladiprelio/Halfsplit.hs view
@@ -30,7 +30,19 @@   -> Int8    -> [a]    -> String-halfsplit g m xs +halfsplit g = halfsplit1G g "" +{-# INLINE halfsplit #-}++-- | Converts the data that is an instance of 'Show' typeclass to be printed in two-column way with+-- customizable ending of each line.+halfsplit1G +  :: (Show a, Eq b) +  => (a -> b)+  -> String -- ^ Additional 'String' added to every line before the \"\\n\" character.+  -> Int8 +  -> [a] +  -> String+halfsplit1G g appendstr m xs   | null xs = []  | otherwise =      let (n, rr2) = quotRem (fromEnum m) (if m < 0 then -10 else 10)@@ -43,7 +55,7 @@            4 -> let us = (replicate (lt2 - ly2) [replicate l0 ' ']) `mappend` reverse (map reverse y2s) in (mconcat us, mconcat t2s)            5 -> let us = (replicate (lt2 - ly2) [replicate l0 ' ']) `mappend` y2s                     ks = reverse . map reverse $ t2s in (mconcat us, mconcat ks)-           _ -> let us = reverse ys in (if rrr == 0 then map show us else replicate l0 ' ':map show us, map show ts) in (\(rs, qs) -> mergePartsLine n "\n" rs qs) $ r+           _ -> let us = reverse ys in (if rrr == 0 then map show us else replicate l0 ' ':map show us, map show ts) in (\(rs, qs) -> mergePartsLine n (appendstr `mappend` "\n") rs qs) $ r               where (ys,ts) = splitAt l xs                      (l,rrr) = length xs `quotRem` 2                     l0 = length . show . head $ xs @@ -58,6 +70,18 @@                     ly2 = sum . map length $ y2s                     lt2 = sum . map length $ t2s +-- | A generalized version of 'halfsplit1G' with the possibility to prepend and append strings to it.+halfsplit2G +  :: (Show a, Eq b) +  => (a -> b)+  -> String -- ^ Additional 'String' added to every line before the \"\\n\" character.+  -> String -- ^ A 'String' that is prepended to the 'halfsplit1G' result.+  -> String -- ^ A 'String' that is appended to the 'halfsplit1G' result.+  -> Int8 +  -> [a] +  -> String+halfsplit2G g appendstr prestr poststr m xs = prestr `mappend` halfsplit1G g appendstr m xs `mappend` poststr+{-# INLINABLE halfsplit2G #-}  mergePartsLine :: Int -> String -> [String] -> [String] -> String mergePartsLine n newlined xs ys = intercalate newlined . zipWith (\x y -> x `mappend` (replicate n (if n < 0 then '\t' else ' ')) `mappend` y) xs $ ys
README.md view
@@ -1,7 +1,7 @@  Devotion  ======== -The author would like to devote this project to support the Foundation GASTROSTARS.+The author would like to devote this project to support the Foundation Gastrostars.  If you would like to share some financial support, please, contact the mentioned foundation using the URL:
halfsplit.cabal view
@@ -1,12 +1,12 @@ cabal-version:      2.4 name:               halfsplit-version:            0.3.0.0+version:            0.4.0.0  -- A short (one-line) description of the package.-synopsis:           A library to provide special kind of two-column terminal output for Phladiprelio. +synopsis:           A library to provide special kind of two-column output for Phladiprelio.   -- A longer description of the package.-description:        Provides functions for two-column terminal output for newer versions of Phladiprelio projects. Is intended to improve UI and UX for the work with them.       +description:        Provides functions for two-column output for newer versions of Phladiprelio projects. Is intended to improve UI and UX for the work with them.         -- A URL where users can report bugs. -- bug-reports: