phonetic-languages-simplified-examples-common 0.1.4.0 → 0.2.0.0
raw patch · 3 files changed
+22/−6 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Phonetic.Languages.Common: fLinesN :: Int -> Int -> String -> [String]
+ Phonetic.Languages.Common: fLinesNIO :: Int -> String -> IO ()
Files
- CHANGELOG.md +6/−0
- Phonetic/Languages/Common.hs +15/−5
- phonetic-languages-simplified-examples-common.cabal +1/−1
CHANGELOG.md view
@@ -21,3 +21,9 @@ ## 0.1.4.0 -- 2021-09-09 * First version revised D. Updated the needed dependencies.++## 0.2.0.0 -- 2021-10-09++* Second version. Added two new parameterized functions fLinesN and fLinesNIO +that can also control the maximum number of words in the line.+
Phonetic/Languages/Common.hs view
@@ -13,7 +13,9 @@ -- module Phonetic.Languages.Common (- fLines+ fLinesN+ , fLines+ , fLinesNIO , fLinesIO ) where @@ -21,8 +23,8 @@ import Data.Char (isAlpha,isSpace) import Data.Monoid (mappend) -fLines :: Int -> String -> [String]-fLines !toOneLine ys = filter (any (\x -> isUkrainianL x && isAlpha x)) . prepareText .+fLinesN :: Int -> Int -> String -> [String]+fLinesN n !toOneLine ys = filter (any (\x -> isUkrainianL x && isAlpha x)) . prepareTextN n . (\z -> if toOneLine == 1 then unls z else z) $ ys -- the 'unls' is taken from the 'Data.List.words' and rewritten to be equal to 'unwords' . 'words' where unls s = case dropWhile isSpace s of@@ -30,9 +32,17 @@ s' -> w `mappend` (' ' : unls s'') where (w, s'') = break isSpace s' +fLines :: Int -> String -> [String]+fLines = fLinesN 7+{-# INLINE fLines #-}++fLinesNIO :: Int -> String -> IO ()+fLinesNIO n ys = mapM_ putStrLn . map (\(i,x) -> show (i + 1) ++ "\t" ++ x) . helpG3 . indexedL "" .+ filter (any (\x -> isUkrainianL x && isAlpha x)) . prepareTextN n $ ys+ fLinesIO :: String -> IO ()-fLinesIO ys = mapM_ putStrLn . map (\(i,x) -> show (i + 1) ++ "\t" ++ x) . helpG3 . indexedL "" .- filter (any (\x -> isUkrainianL x && isAlpha x)) . prepareText $ ys+fLinesIO = fLinesNIO 7+{-# INLINE fLinesIO #-} -- | Is taken mostly from the Phonetic.Languages.Simplified.Lists.UniquenessPeriodsG module from the @phonetic-languages-simplified-common@ package. indexedL :: Foldable t => b -> t b -> [(Int, b)]
phonetic-languages-simplified-examples-common.cabal view
@@ -2,7 +2,7 @@ -- further documentation, see http://haskell.org/cabal/users-guide/ name: phonetic-languages-simplified-examples-common-version: 0.1.4.0+version: 0.2.0.0 synopsis: Some commonly used by phonetic-languages-simplified* series functions. description: Are intended to be used by the phonetic-languages-simplified-lists-examples and phonetic-languages-simplified-examples-array packages. homepage: https://hackage.haskell.org/package/phonetic-languages-simplified-examples-common