phonetic-languages-simplified-base 0.2.0.0 → 0.3.0.0
raw patch · 5 files changed
+38/−22 lines, 5 filesdep ~basedep ~phonetic-languages-permutations-arraydep ~subGPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base, phonetic-languages-permutations-array, subG
API changes (from Hackage documentation)
- Phonetic.Languages.Simplified.DataG.Base: getAB :: FuncRep2 a b c -> a -> b
- Phonetic.Languages.Simplified.DataG.Base: getBC :: FuncRep2 a b c -> b -> c
+ Phonetic.Languages.Simplified.DataG.Base: [getAB] :: FuncRep2 a b c -> a -> b
+ Phonetic.Languages.Simplified.DataG.Base: [getBC] :: FuncRep2 a b c -> b -> c
Files
- CHANGELOG.md +4/−0
- Phonetic/Languages/Simplified/DataG/Base.hs +17/−8
- Phonetic/Languages/Simplified/Lists/UniquenessPeriodsG/Base.hs +7/−4
- Phonetic/Languages/Simplified/StrictVG/Base.hs +6/−6
- phonetic-languages-simplified-base.cabal +4/−4
CHANGELOG.md view
@@ -7,3 +7,7 @@ ## 0.2.0.0 -- 2021-02-15 * Second version. Added a function uniquenessPeriodsG to the Phonetic.Languages.Simplified.Lists.UniquenessPeriodsG.Base module.++## 0.3.0.0 -- 2021-10-04++* Third version. Some code improvements. Some minor documentation improvements. Updated the dependencies boundaries.
Phonetic/Languages/Simplified/DataG/Base.hs view
@@ -2,7 +2,7 @@ -- | -- Module : Phonetic.Languages.Simplified.DataG.Base--- Copyright : (c) OleksandrZhabenko 2020+-- Copyright : (c) OleksandrZhabenko 2020-2021 -- License : MIT -- Stability : Experimental -- Maintainer : olexandr543@yahoo.com@@ -28,17 +28,13 @@ !EQ -> compare (line x) (line y) !z -> z !z0 -> z0+ {-# INLINE compare #-} -data FuncRep2 a b c = D (a -> b) (b -> c)+data FuncRep2 a b c = D { getAB :: (a -> b), getBC :: (b -> c) } getAC :: FuncRep2 a b c -> (a -> c) getAC (D f g) = g . f--getAB :: FuncRep2 a b c -> (a -> b)-getAB (D f _) = f--getBC :: FuncRep2 a b c -> (b -> c)-getBC (D _ g) = g+{-# INLINE getAC #-} maximumEl :: (Foldable t2, Ord c) => FuncRep2 (t a) b c@@ -48,6 +44,7 @@ let !l = F.maximumBy (\x y -> compare (getAC frep2 x) (getAC frep2 y)) data0 !m = getAB frep2 l !tm = getBC frep2 m in R {line = l, propertiesF = m, transPropertiesF = tm}+{-# INLINE maximumEl #-} minMaximumEls :: (InsertLeft t2 (t a), Monoid (t2 (t a)), Ord (t a), Ord c) => FuncRep2 (t a) b c@@ -59,16 +56,19 @@ !mx = getAB frep2 lx !tmn = getBC frep2 mn !tmx = getBC frep2 mx in (R {line = ln, propertiesF = mn, transPropertiesF = tmn}, R {line = lx, propertiesF = mx, transPropertiesF = tmx})+{-# INLINE minMaximumEls #-} maximumElR :: (Foldable t2, Ord c) => t2 (Result t a b c) -> Result t a b c maximumElR = F.maximumBy (\x y -> compare (transPropertiesF x) (transPropertiesF y))+{-# INLINE maximumElR #-} 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) minMaximumElRs = minMax11ByC (\x y -> compare (transPropertiesF x) (transPropertiesF y))+{-# INLINE minMaximumElRs #-} ----------------------------------------------------------------------------------- @@ -79,6 +79,7 @@ -> (t2 (t a), t2 (t a)) innerPartitioning !frep2 data0 = let !l = F.maximum . mapG (toTransPropertiesF' frep2) $ data0 in partitionG ((== l) . getAC frep2) data0+{-# INLINE innerPartitioning #-} -- | The second argument must be not empty for the function to work correctly. innerPartitioningR@@ -86,6 +87,7 @@ -> (t2 (Result t a b c), t2 (Result t a b c)) innerPartitioningR dataR = let !l = F.maximum . mapG transPropertiesF $ dataR in partitionG ((== l) . transPropertiesF) dataR+{-# INLINE innerPartitioningR #-} maximumGroupsClassification :: (InsertLeft t2 (t a), Monoid (t2 (t a)), Ord c, InsertLeft t2 c, Monoid (t2 c), Integral d) => d@@ -97,6 +99,7 @@ | nGroups <= 0 = (dataT,dataF) | otherwise = maximumGroupsClassification (nGroups - 1) frep2 (dataT `mappend` partT,partF) where (!partT,!partF) = innerPartitioning frep2 dataF+{-# NOINLINE maximumGroupsClassification #-} maximumGroupsClassification1 :: (InsertLeft t2 (t a), Monoid (t2 (t a)), Ord c, InsertLeft t2 c, Monoid (t2 c), Integral d) => d@@ -107,6 +110,7 @@ | F.null data0 = (mempty,mempty) | nGroups <= 0 = innerPartitioning frep2 data0 | otherwise = maximumGroupsClassification (nGroups - 1) frep2 . innerPartitioning frep2 $ data0+{-# NOINLINE maximumGroupsClassification1 #-} maximumGroupsClassificationR2 :: (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@@ -117,6 +121,7 @@ | nGroups <= 0 = (dataT,dataF) | otherwise = maximumGroupsClassificationR2 (nGroups - 1) (dataT `mappend` partT,partF) where (!partT,!partF) = innerPartitioningR dataF+{-# NOINLINE maximumGroupsClassificationR2 #-} maximumGroupsClassificationR :: (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@@ -126,6 +131,7 @@ | F.null dataR = (mempty,mempty) | nGroups <= 0 = innerPartitioningR dataR | otherwise = maximumGroupsClassificationR2 (nGroups - 1) . innerPartitioningR $ dataR+{-# NOINLINE maximumGroupsClassificationR #-} toResultR :: FuncRep2 (t a) b c@@ -134,15 +140,18 @@ toResultR !frep2 !ys = R { line = ys, propertiesF = m, transPropertiesF = tm} where !m = getAB frep2 ys !tm = getBC frep2 m+{-# INLINE toResultR #-} toPropertiesF' :: FuncRep2 (t a) b c -> t a -> b toPropertiesF' !frep2 !ys = getAB frep2 ys+{-# INLINE toPropertiesF' #-} toTransPropertiesF' :: FuncRep2 (t a) b c -> t a -> c toTransPropertiesF' !frep2 !ys = getAC frep2 ys+{-# INLINE toTransPropertiesF' #-}
Phonetic/Languages/Simplified/Lists/UniquenessPeriodsG/Base.hs view
@@ -2,7 +2,7 @@ -- | -- Module : Phonetic.Languages.Simplified.Lists.UniquenessPeriodsG.Base--- Copyright : (c) OleksandrZhabenko 2020+-- Copyright : (c) OleksandrZhabenko 2020-2021 -- License : MIT -- Stability : Experimental -- Maintainer : olexandr543@yahoo.com@@ -27,7 +27,7 @@ diverse2GL :: Foldable t => String -> t Char -> Int16 diverse2GL whspss = sum . uniquenessPeriodsG whspss {-# INLINE diverse2GL #-}- + -- | A generalization of the uniquenessPeriods function of the @uniqueness-periods@ package. uniquenessPeriodsG :: Foldable t => String -> t Char -> [Int16] uniquenessPeriodsG whspss ws@@ -39,8 +39,11 @@ | (`elem` whspss) . snd $ x = Just (fst x) | otherwise = Nothing {-# INLINE g #-}- f !x = if null x then Nothing else let !idX0 = snd . head $ x in Just . (\vws (v2,v3) -> ((helpUPV3 vws [] .- map fst $ v2,snd . head $ v2),v3)) vs . partition (\(_,xs) -> xs == idX0) $ x + f !x+ | null x = Nothing+ | otherwise = let !idX0 = snd . head $ x in Just . (\vws (v2,v3) -> ((helpUPV3 vws [] .+ map fst $ v2,snd . head $ v2),v3)) vs . partition (\(_,xs) -> xs == idX0) $ x+{-# INLINE uniquenessPeriodsG #-} -- | The first and the third list arguments of numbers (if not empty) must be sorted in the ascending order. helpUPV3 :: [Int16] -> [Int16] -> [Int16] -> [Int16]
Phonetic/Languages/Simplified/StrictVG/Base.hs view
@@ -2,7 +2,7 @@ -- | -- Module : Phonetic.Languages.Simplified.StrictVG.Base--- Copyright : (c) OleksandrZhabenko 2020+-- Copyright : (c) OleksandrZhabenko 2020-2021 -- License : MIT -- Stability : Experimental -- Maintainer : olexandr543@yahoo.com@@ -43,15 +43,15 @@ -> (t a -> [a]) -- ^ The function that is used internally to convert to the @[a]@ so that the function can process further the permutations -> ((t (t a)) -> [[a]]) -- ^ The function that is used internally to convert to the @[[a]]@ so that the function can process further -> ([a] -> t a) -- ^ The function that is used internally to convert to the needed representation that the function can process further- -> [Array Int Int] -- ^ The permutations of 'Int' indices starting from 0 and up to n (n is probably less than 7).+ -> [Array Int Int] -- ^ The permutations of 'Int' indices starting from 0 and up to n (n is probably less than 8). -> t (t a) -- ^ Must be obtained as @subG whspss xs@ -> [t a] uniquenessVariants2GNPBL !ts !us !hd f1 f2 f3 perms !subs | F.null subs = mempty- | otherwise =- let !uss = (hd %@ us) %^ mempty+ | otherwise = map f3 ns+ where !uss = (hd %@ us) %^ mempty !base0 = map (hd %@) . f2 $ subs !l = length base0 !baseArr = listArray (0,l - 1) base0- !ns = universalSetGL ts uss f1 f2 perms baseArr in map f3 ns-+ !ns = universalSetGL ts uss f1 f2 perms baseArr -- in map f3 ns+{-# INLINE uniquenessVariants2GNPBL #-}
phonetic-languages-simplified-base.cabal view
@@ -3,9 +3,9 @@ -- http://haskell.org/cabal/users-guide/ name: phonetic-languages-simplified-base-version: 0.2.0.0-synopsis: A simplified version of the phonetic-languages functionality common for some different realizations.-description: A simplified version of the phonetic-languages functionality. Tries to use only necessary functionality and reduce the other ones.+version: 0.3.0.0+synopsis: A basics of the phonetic-languages functionality.+description: The common for different realizations functionality. Just the necessary one. homepage: https://hackage.haskell.org/package/phonetic-languages-simlified-base license: MIT license-file: LICENSE@@ -21,6 +21,6 @@ exposed-modules: Phonetic.Languages.Simplified.DataG.Base, Phonetic.Languages.Simplified.StrictVG.Base, Phonetic.Languages.Simplified.Lists.UniquenessPeriodsG.Base -- other-modules: other-extensions: BangPatterns, FlexibleContexts, MultiParamTypeClasses- build-depends: base >=4.8 && <4.15, subG >=0.4.2 && <1, phonetic-languages-permutations-array >=0.1 && <1+ build-depends: base >=4.8 && <4.16, subG >=0.5.2 && <1, phonetic-languages-permutations-array >=0.2 && <1 -- hs-source-dirs: default-language: Haskell2010