phonetic-languages-simplified-base 0.8.0.0 → 0.9.0.0
raw patch · 4 files changed
+78/−4 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Data.ChooseLine: compareFilesToOneCommon :: Int -> [FilePath] -> FilePath -> IO ()
+ Data.ChooseLine: readFileIfAny :: FilePath -> IO String
+ Data.ChooseLine: toFileStr :: FilePath -> [String] -> IO ()
- Phladiprelio.DataG: innerPartitioningR :: forall t2 (t :: Type -> Type) a b c. (InsertLeft t2 (Result t a b c), Monoid (t2 (Result t a b c)), InsertLeft t2 c, Monoid (t2 c), Ord c) => t2 (Result t a b c) -> (t2 (Result t a b c), t2 (Result t a b c))
+ Phladiprelio.DataG: innerPartitioningR :: (InsertLeft t2 (Result t a b c), Monoid (t2 (Result t a b c)), InsertLeft t2 c, Monoid (t2 c), Ord c) => t2 (Result t a b c) -> (t2 (Result t a b c), t2 (Result t a b c))
- Phladiprelio.DataG: maximumElR :: forall t2 c (t :: Type -> Type) a b. (Foldable t2, Ord c) => t2 (Result t a b c) -> Result t a b c
+ Phladiprelio.DataG: maximumElR :: (Foldable t2, Ord c) => t2 (Result t a b c) -> Result t a b c
- Phladiprelio.DataG: maximumGroupsClassificationR :: forall a b (t :: Type -> Type) t2 c d. (Eq a, Eq b, Eq (t a), InsertLeft t2 (Result t a b c), Monoid (t2 (Result t a b c)), InsertLeft t2 c, Monoid (t2 c), Ord c, Integral d) => d -> t2 (Result t a b c) -> (t2 (Result t a b c), t2 (Result t a b c))
+ Phladiprelio.DataG: maximumGroupsClassificationR :: (Eq a, Eq b, Eq (t a), InsertLeft t2 (Result t a b c), Monoid (t2 (Result t a b c)), InsertLeft t2 c, Monoid (t2 c), Ord c, Integral d) => d -> t2 (Result t a b c) -> (t2 (Result t a b c), t2 (Result t a b c))
- Phladiprelio.DataG: maximumGroupsClassificationR2 :: forall a b (t :: Type -> Type) t2 c d. (Eq a, Eq b, Eq (t a), InsertLeft t2 (Result t a b c), Monoid (t2 (Result t a b c)), Ord c, InsertLeft t2 c, Monoid (t2 c), Integral d) => d -> (t2 (Result t a b c), t2 (Result t a b c)) -> (t2 (Result t a b c), t2 (Result t a b c))
+ Phladiprelio.DataG: maximumGroupsClassificationR2 :: (Eq a, Eq b, Eq (t a), InsertLeft t2 (Result t a b c), Monoid (t2 (Result t a b c)), Ord c, InsertLeft t2 c, Monoid (t2 c), Integral d) => d -> (t2 (Result t a b c), t2 (Result t a b c)) -> (t2 (Result t a b c), t2 (Result t a b c))
- Phladiprelio.DataG: minMaximumElRs :: forall t2 (t :: Type -> Type) a b c. (InsertLeft t2 (Result t a b c), Monoid (t2 (Result t a b c)), Ord (t a), Ord b, Ord c) => t2 (Result t a b c) -> (Result t a b c, Result t a b c)
+ Phladiprelio.DataG: minMaximumElRs :: (InsertLeft t2 (Result t a b c), Monoid (t2 (Result t a b c)), Ord (t a), Ord b, Ord c) => t2 (Result t a b c) -> (Result t a b c, Result t a b c)
- Phladiprelio.DataG: partiR :: forall t2 (t :: Type -> Type) a b c. (InsertLeft t2 (Result t a b c), Monoid (t2 (Result t a b c)), InsertLeft t2 c) => (c -> Bool) -> t2 (Result t a b c) -> (t2 (Result t a b c), t2 (Result t a b c))
+ Phladiprelio.DataG: partiR :: (InsertLeft t2 (Result t a b c), Monoid (t2 (Result t a b c)), InsertLeft t2 c) => (c -> Bool) -> t2 (Result t a b c) -> (t2 (Result t a b c), t2 (Result t a b c))
- Phladiprelio.Partir: class Foldable t => ConstraintsG (t :: Type -> Type) a
+ Phladiprelio.Partir: class Foldable t => ConstraintsG t a
Files
- CHANGELOG.md +5/−1
- Data/ChooseLine.hs +67/−0
- README.md +2/−0
- phonetic-languages-simplified-base.cabal +4/−3
CHANGELOG.md view
@@ -71,4 +71,8 @@ ## 0.8.0.0 -- 2024-01-24 * Eighth version. Added bug-tracker on Github. Generalized functions with specializing. Updated the dependencies, switched to minmax and monoid-insertleft instead of subG.- ++ ## 0.9.0.0 -- 2024-03-08++* Ninth version. Added a new module Data.ChooseLine with common functionality for PhLADiPreLiO mostly taken and rewritten from previous implementations. +
+ Data/ChooseLine.hs view
@@ -0,0 +1,67 @@+{-# OPTIONS_HADDOCK show-extensions #-}++-- |+-- Module : Data.ChooseLine+-- Copyright : (c) Oleksandr Zhabenko 2021-2024+-- License : MIT+-- Stability : Experimental+-- Maintainer : oleksandr.zhabenko@yahoo.com+--+-- General shared by phladiprelio-ukrainian-simple and phladiprelio-general-simple functionality to compare contents of the up to 14 files line-by-line +-- and to choose the resulting option. ++{-# LANGUAGE NoImplicitPrelude, ScopedTypeVariables #-}++module Data.ChooseLine where++import GHC.Base+import Data.Foldable (mapM_) +import Data.Maybe (fromMaybe) +import Text.Show (Show(..))+import Text.Read (readMaybe)+import System.IO (putStrLn, FilePath,getLine,appendFile,putStr,readFile)+import Data.List+import Data.Tuple (fst,snd)+import Control.Exception (IOException,catch) ++-- | Is rewritten from the <https://hackage.haskell.org/package/phonetic-languages-simplified-examples-array-0.21.0.0/docs/src/Phonetic.Languages.Lines.html#compareFilesToOneCommon>+-- Given a list of different filepaths and the resulting filepath for the accumulated data provides a simple way to compare options of the lines in every file in the+-- first argument and to choose that option for the resulting file. Therefore, the resulting file can combine options for lines from various sources.+compareFilesToOneCommon + :: Int -- ^ A number of files to be read and treated as sources of lines to choose from.+ -> [FilePath] + -> FilePath + -> IO ()+compareFilesToOneCommon n files file3 = do+ contentss <- mapM ((\(j,ks) -> do {readFileIfAny ks >>= \fs -> return (j, zip [1..] . lines $ fs)})) . zip [1..] . take n $ files+ compareF contentss file3+ where compareF :: [(Int,[(Int,String)])] -> FilePath -> IO ()+ compareF ysss file3 = mapM_ (\i -> do+ putStr "Please, specify which variant to use as the result, "+ putStrLn "maximum number is the quantity of the files from which the data is read: "+ let strs = map (\(j,ks) -> (\ts -> if null ts then (j,"")+ else let (_,rs) = head ts in (j,rs)) .+ filter ((== i) . fst) $ ks) ysss+ putStrLn . unlines . map (\(i,xs) -> show i ++ ":\t" ++ xs) $ strs+ ch <- getLine+ let choice2 = fromMaybe 0 (readMaybe ch::Maybe Int)+ toFileStr file3 ((\us -> if null us then [""] else [snd . head $ us]) . filter ((== choice2) . fst) $ strs)) $ [1..]++{-| Inspired by: 'https://hackage.haskell.org/package/base-4.15.0.0/docs/src/GHC-IO.html#catch' + Is taken from the +https://hackage.haskell.org/package/string-interpreter-0.8.0.0/docs/src/Interpreter.StringConversion.html#readFileIfAny+to reduce general quantity of dependencies.+Reads a textual file given by its 'FilePath' and returns its contents lazily. If there is+some 'IOException' thrown or an empty file then returns just "". Raises an exception for the binary file. -}+readFileIfAny :: FilePath -> IO String+readFileIfAny file = catch (readFile file) (\(_ :: IOException) -> return "")+{-# INLINE readFileIfAny #-}++-- | Prints list of 'String's to the file as a multiline 'String' with default line ending. Uses 'appendFile' function inside.+toFileStr ::+ FilePath -- ^ The 'FilePath' to the file to be written in the 'AppendMode' (actually appended with) the information output.+ -> [String] -- ^ Each element is appended on the new line to the file.+ -> IO ()+toFileStr file = appendFile file . unlines+{-# INLINE toFileStr #-}+
README.md view
@@ -7,6 +7,8 @@ On the 06/01/2024 there is Sophie's Kok, a sister of Emma Kok, 19th Birthday (she is 18). Therefore, the version 0.8.0.0 is additionally devoted also to her. On the 22/01/2023 there is Day of Unity of Ukraine, and on the 23/01/2024 the Orthodox Christians have memory of St. Paulinus of Nola. +On the 08/03/2024 there is International Women's Day.+ Besides, you can support Ukraine and Ukrainian people. All support is welcome, including donations for the needs of the Ukrainian army, IDPs and refugees.
phonetic-languages-simplified-base.cabal view
@@ -3,7 +3,7 @@ -- http://haskell.org/cabal/users-guide/ name: phonetic-languages-simplified-base-version: 0.8.0.0+version: 0.9.0.0 synopsis: A basics of the phonetic-languages functionality that can be groupped. description: The common for different realizations of PhLADiPreLiO functionality. Just the necessary one. homepage: https://hackage.haskell.org/package/phonetic-languages-simlified-base@@ -19,9 +19,10 @@ cabal-version: >=1.10 library- exposed-modules: Phladiprelio.DataG, Phladiprelio.StrictVG, Phladiprelio.Partir+ exposed-modules: Phladiprelio.DataG, Phladiprelio.StrictVG, Phladiprelio.Partir, Data.ChooseLine -- other-modules:- other-extensions: BangPatterns, FlexibleContexts, MultiParamTypeClasses, NoImplicitPrelude+ -- ghc-options: -Wall+ other-extensions: BangPatterns, FlexibleContexts, MultiParamTypeClasses, NoImplicitPrelude, ScopedTypeVariables build-depends: base >=4.13 && <5, monoid-insertleft ==0.1.0.1, phonetic-languages-permutations-array ==0.5.0.0, phonetic-languages-basis ==0.3.0.0, minmax ==0.1.1.0 -- hs-source-dirs: default-language: Haskell2010