phonetic-languages-simplified-examples-common 0.6.0.0 → 0.6.1.0
raw patch · 4 files changed
+70/−65 lines, 4 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Phladiprelio.Ukrainian.Common: fLines :: Int -> String -> [String]
- Phladiprelio.Ukrainian.Common: fLinesIO :: String -> IO ()
- Phladiprelio.Ukrainian.Common: fLinesN :: Int -> Int -> String -> [String]
- Phladiprelio.Ukrainian.Common: fLinesNIO :: Int -> String -> IO ()
+ Phladiprelio.Ukrainian.CommonE: fLines :: Int -> String -> [String]
+ Phladiprelio.Ukrainian.CommonE: fLinesIO :: String -> IO ()
+ Phladiprelio.Ukrainian.CommonE: fLinesN :: Int -> Int -> String -> [String]
+ Phladiprelio.Ukrainian.CommonE: fLinesNIO :: Int -> String -> IO ()
Files
- CHANGELOG.md +5/−0
- Phladiprelio/Ukrainian/Common.hs +0/−63
- Phladiprelio/Ukrainian/CommonE.hs +63/−0
- phonetic-languages-simplified-examples-common.cabal +2/−2
CHANGELOG.md view
@@ -76,3 +76,8 @@ * Sixth version. Switched to NoImplicitPrelude extension. Updated the dependencies boundaries to support the new functionality.++## 0.6.1.0 -- 2023-03-02++* Sixth version revised A. Fixed issue with the same name of the module from the phonetic-languages-simplified-properties-array-common package.+
− Phladiprelio/Ukrainian/Common.hs
@@ -1,63 +0,0 @@-{-# OPTIONS_GHC -threaded -rtsopts #-}-{-# OPTIONS_HADDOCK show-extensions #-}-{-# LANGUAGE BangPatterns, FlexibleContexts, NoImplicitPrelude #-}---- |--- Module : Phladiprelio.Ukrainian.Common--- Copyright : (c) Oleksandr Zhabenko 2020-2023--- License : MIT--- Stability : Experimental--- Maintainer : oleksandr.zhabenko@yahoo.com------ Some functions to provide show and print functionality for PhLADiPreLiO for Ukrainian language.-----module Phladiprelio.Ukrainian.Common (- fLinesN- , fLines- , fLinesNIO- , fLinesIO-) where--import GHC.Base hiding (foldr)-import GHC.List (filter, break, dropWhile, init)-import Phladiprelio.Ukrainian.PrepareText-import Data.Char (isAlpha,isSpace)-import Data.Monoid (mappend)-import Data.Foldable (Foldable (..), any)-import GHC.Num ((+),(-))-import Text.Show (show)-import System.IO (putStrLn)--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- "" -> []- 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) `mappend` "\t" `mappend` x) . helpG3 . indexedL "" .- filter (any (\x -> isUkrainianL x && isAlpha x)) . prepareTextN n $ ys) >> return ()--fLinesIO :: String -> IO ()-fLinesIO = fLinesNIO 7-{-# INLINE fLinesIO #-}---- | Is taken mostly from the Phonetic.Languages.Ukrainian.Simplified.Lists.UniquenessPeriodsG module from the @phonetic-languages-simplified-common@ package.-indexedL :: Foldable t => b -> t b -> [(Int, b)]-indexedL y zs = foldr f v zs- where !v = [(length zs,y)]- f x ((j,z):ys) = (j-1,x):(j,z):ys-{-# INLINE indexedL #-}--helpG3 :: [a] -> [a]-helpG3 xs- | null xs = []- | otherwise = init xs
+ Phladiprelio/Ukrainian/CommonE.hs view
@@ -0,0 +1,63 @@+{-# OPTIONS_GHC -threaded -rtsopts #-}+{-# OPTIONS_HADDOCK show-extensions #-}+{-# LANGUAGE BangPatterns, FlexibleContexts, NoImplicitPrelude #-}++-- |+-- Module : Phladiprelio.Ukrainian.CommonE+-- Copyright : (c) Oleksandr Zhabenko 2020-2023+-- License : MIT+-- Stability : Experimental+-- Maintainer : oleksandr.zhabenko@yahoo.com+--+-- Some functions to provide show and print functionality for PhLADiPreLiO for Ukrainian language.+--++module Phladiprelio.Ukrainian.CommonE (+ fLinesN+ , fLines+ , fLinesNIO+ , fLinesIO+) where++import GHC.Base hiding (foldr)+import GHC.List (filter, break, dropWhile, init)+import Phladiprelio.Ukrainian.PrepareText+import Data.Char (isAlpha,isSpace)+import Data.Monoid (mappend)+import Data.Foldable (Foldable (..), any)+import GHC.Num ((+),(-))+import Text.Show (show)+import System.IO (putStrLn)++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+ "" -> []+ 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) `mappend` "\t" `mappend` x) . helpG3 . indexedL "" .+ filter (any (\x -> isUkrainianL x && isAlpha x)) . prepareTextN n $ ys) >> return ()++fLinesIO :: String -> IO ()+fLinesIO = fLinesNIO 7+{-# INLINE fLinesIO #-}++-- | Is taken mostly from the Phonetic.Languages.Ukrainian.Simplified.Lists.UniquenessPeriodsG module from the @phonetic-languages-simplified-common@ package.+indexedL :: Foldable t => b -> t b -> [(Int, b)]+indexedL y zs = foldr f v zs+ where !v = [(length zs,y)]+ f x ((j,z):ys) = (j-1,x):(j,z):ys+{-# INLINE indexedL #-}++helpG3 :: [a] -> [a]+helpG3 xs+ | null xs = []+ | otherwise = init xs
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.6.0.0+version: 0.6.1.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@@ -17,7 +17,7 @@ cabal-version: >=1.10 library- exposed-modules: Phladiprelio.Ukrainian.DeEnCoding, Phladiprelio.Ukrainian.SimpleConstraints, Phladiprelio.Ukrainian.Common+ exposed-modules: Phladiprelio.Ukrainian.DeEnCoding, Phladiprelio.Ukrainian.SimpleConstraints, Phladiprelio.Ukrainian.CommonE -- other-modules: other-extensions: BangPatterns, NoImplicitPrelude build-depends: base >=4.13 && <5, heaps >= 0.3.6.1 && <1, phonetic-languages-ukrainian-array ==0.10.0.0, phonetic-languages-simplified-properties-array ==0.17.1.0, ukrainian-phonetics-basic-array ==0.7.0.0