phonetic-languages-simplified-base 0.6.1.0 → 0.7.0.0
raw patch · 9 files changed
+426/−417 lines, 9 filesdep ~basedep ~phonetic-languages-basisdep ~phonetic-languages-permutations-arrayPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base, phonetic-languages-basis, phonetic-languages-permutations-array, subG
API changes (from Hackage documentation)
- Phonetic.Languages.Simplified.DataG.Base: innerPartitioning :: (InsertLeft t2 (t a), Monoid (t2 (t a)), InsertLeft t2 c, Monoid (t2 c), Ord c) => FuncRep2 (t a) b c -> t2 (t a) -> (t2 (t a), t2 (t a))
- Phonetic.Languages.Simplified.DataG.Base: innerPartitioning2 :: (InsertLeft t2 a, Monoid (t2 a), InsertLeft t2 c, Monoid (t2 c), Ord c) => FuncRep2 a b c -> t2 a -> (t2 a, t2 a)
- Phonetic.Languages.Simplified.DataG.Base: 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))
- Phonetic.Languages.Simplified.DataG.Base: innerPartitioningR2 :: (InsertLeft t2 (Result2 a b c), Monoid (t2 (Result2 a b c)), InsertLeft t2 c, Monoid (t2 c), Ord c) => t2 (Result2 a b c) -> (t2 (Result2 a b c), t2 (Result2 a b c))
- Phonetic.Languages.Simplified.DataG.Base: maximumEl :: (Foldable t2, Ord c) => FuncRep2 (t a) b c -> t2 (t a) -> Result t a b c
- Phonetic.Languages.Simplified.DataG.Base: maximumEl2 :: (Foldable t2, Ord c) => FuncRep2 a b c -> t2 a -> Result2 a b c
- Phonetic.Languages.Simplified.DataG.Base: maximumElR :: (Foldable t2, Ord c) => t2 (Result t a b c) -> Result t a b c
- Phonetic.Languages.Simplified.DataG.Base: maximumElR2 :: (Foldable t2, Ord c) => t2 (Result2 a b c) -> Result2 a b c
- Phonetic.Languages.Simplified.DataG.Base: maximumGroupsClassification :: (InsertLeft t2 (t a), Monoid (t2 (t a)), Ord c, InsertLeft t2 c, Monoid (t2 c), Integral d) => d -> FuncRep2 (t a) b c -> (t2 (t a), t2 (t a)) -> (t2 (t a), t2 (t a))
- Phonetic.Languages.Simplified.DataG.Base: maximumGroupsClassification1 :: (InsertLeft t2 (t a), Monoid (t2 (t a)), Ord c, InsertLeft t2 c, Monoid (t2 c), Integral d) => d -> FuncRep2 (t a) b c -> t2 (t a) -> (t2 (t a), t2 (t a))
- Phonetic.Languages.Simplified.DataG.Base: maximumGroupsClassification12 :: (InsertLeft t2 a, Monoid (t2 a), Ord c, InsertLeft t2 c, Monoid (t2 c), Integral d) => d -> FuncRep2 a b c -> t2 a -> (t2 a, t2 a)
- Phonetic.Languages.Simplified.DataG.Base: maximumGroupsClassification2 :: (InsertLeft t2 a, Monoid (t2 a), Ord c, InsertLeft t2 c, Monoid (t2 c), Integral d) => d -> FuncRep2 a b c -> (t2 a, t2 a) -> (t2 a, t2 a)
- Phonetic.Languages.Simplified.DataG.Base: 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 -> t2 (Result t a b c) -> (t2 (Result t a b c), t2 (Result t a b c))
- Phonetic.Languages.Simplified.DataG.Base: 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 -> (t2 (Result t a b c), t2 (Result t a b c)) -> (t2 (Result t a b c), t2 (Result t a b c))
- Phonetic.Languages.Simplified.DataG.Base: maximumGroupsClassificationR2_2 :: (InsertLeft t2 (Result2 a b c), Monoid (t2 (Result2 a b c)), Ord c, InsertLeft t2 c, Monoid (t2 c), Integral d) => d -> (t2 (Result2 a b c), t2 (Result2 a b c)) -> (t2 (Result2 a b c), t2 (Result2 a b c))
- Phonetic.Languages.Simplified.DataG.Base: maximumGroupsClassificationR_2 :: (InsertLeft t2 (Result2 a b c), Monoid (t2 (Result2 a b c)), InsertLeft t2 c, Monoid (t2 c), Ord c, Integral d) => d -> t2 (Result2 a b c) -> (t2 (Result2 a b c), t2 (Result2 a b c))
- Phonetic.Languages.Simplified.DataG.Base: 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)
- Phonetic.Languages.Simplified.DataG.Base: minMaximumElRs2 :: (InsertLeft t2 (Result2 a b c), Monoid (t2 (Result2 a b c)), Ord a, Ord b, Ord c) => t2 (Result2 a b c) -> (Result2 a b c, Result2 a b c)
- Phonetic.Languages.Simplified.DataG.Base: minMaximumEls :: (InsertLeft t2 (t a), Monoid (t2 (t a)), Ord (t a), Ord c) => FuncRep2 (t a) b c -> t2 (t a) -> (Result t a b c, Result t a b c)
- Phonetic.Languages.Simplified.DataG.Base: minMaximumEls2 :: (InsertLeft t2 a, Monoid (t2 a), Ord a, Ord c) => FuncRep2 a b c -> t2 a -> (Result2 a b c, Result2 a b c)
- Phonetic.Languages.Simplified.DataG.Base: 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))
- Phonetic.Languages.Simplified.DataG.Base: partiR2 :: (InsertLeft t2 (Result2 a b c), Monoid (t2 (Result2 a b c)), InsertLeft t2 c) => (c -> Bool) -> t2 (Result2 a b c) -> (t2 (Result2 a b c), t2 (Result2 a b c))
- Phonetic.Languages.Simplified.DataG.Base: toPropertiesF' :: FuncRep2 (t a) b c -> t a -> b
- Phonetic.Languages.Simplified.DataG.Base: toPropertiesF'2 :: FuncRep2 a b c -> a -> b
- Phonetic.Languages.Simplified.DataG.Base: toResultR :: FuncRep2 (t a) b c -> t a -> Result t a b c
- Phonetic.Languages.Simplified.DataG.Base: toResultR2 :: FuncRep2 a b c -> a -> Result2 a b c
- Phonetic.Languages.Simplified.DataG.Base: toTransPropertiesF' :: FuncRep2 (t a) b c -> t a -> c
- Phonetic.Languages.Simplified.DataG.Base: toTransPropertiesF'2 :: FuncRep2 a b c -> a -> c
- Phonetic.Languages.Simplified.DataG.Partir: class Foldable t => ConstraintsG t a
- Phonetic.Languages.Simplified.DataG.Partir: decodeCDouble :: ConstraintsG t a => t a -> Double -> Bool
- Phonetic.Languages.Simplified.DataG.Partir: instance Phonetic.Languages.Simplified.DataG.Partir.ConstraintsG [] GHC.Types.Char
- Phonetic.Languages.Simplified.DataG.Partir: partitioningR :: (InsertLeft t2 (Result [] Char b Double), Monoid (t2 (Result [] Char b Double)), InsertLeft t2 Double, Monoid (t2 Double)) => String -> t2 (Result [] Char b Double) -> (t2 (Result [] Char b Double), t2 (Result [] Char b Double))
- Phonetic.Languages.Simplified.DataG.Partir: partitioningR2 :: (InsertLeft t2 (Result2 a b Double), Monoid (t2 (Result2 a b Double)), InsertLeft t2 Double, Monoid (t2 Double)) => String -> t2 (Result2 a b Double) -> (t2 (Result2 a b Double), t2 (Result2 a b Double))
- Phonetic.Languages.Simplified.StrictVG.Base: uniquenessVariants2GNBL :: (Eq a, Foldable t, InsertLeft t a, Monoid (t a), Monoid (t (t a))) => a -> (t a -> [a]) -> (t (t a) -> [[a]]) -> ([a] -> t a) -> [Array Int Int] -> t (t a) -> [t a]
- Phonetic.Languages.Simplified.StrictVG.Base: uniquenessVariants2GNPBL :: (Eq a, Foldable t, InsertLeft t a, Monoid (t a), Monoid (t (t a))) => t a -> t a -> a -> (t a -> [a]) -> (t (t a) -> [[a]]) -> ([a] -> t a) -> [Array Int Int] -> t (t a) -> [t a]
+ Phladiprelio.DataG: innerPartitioning :: (InsertLeft t2 (t a), Monoid (t2 (t a)), InsertLeft t2 c, Monoid (t2 c), Ord c) => FuncRep2 (t a) b c -> t2 (t a) -> (t2 (t a), t2 (t a))
+ Phladiprelio.DataG: innerPartitioning2 :: (InsertLeft t2 a, Monoid (t2 a), InsertLeft t2 c, Monoid (t2 c), Ord c) => FuncRep2 a b c -> t2 a -> (t2 a, t2 a)
+ 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: innerPartitioningR2 :: (InsertLeft t2 (Result2 a b c), Monoid (t2 (Result2 a b c)), InsertLeft t2 c, Monoid (t2 c), Ord c) => t2 (Result2 a b c) -> (t2 (Result2 a b c), t2 (Result2 a b c))
+ Phladiprelio.DataG: maximumEl :: (Foldable t2, Ord c) => FuncRep2 (t a) b c -> t2 (t a) -> Result t a b c
+ Phladiprelio.DataG: maximumEl2 :: (Foldable t2, Ord c) => FuncRep2 a b c -> t2 a -> Result2 a b c
+ Phladiprelio.DataG: maximumElR :: (Foldable t2, Ord c) => t2 (Result t a b c) -> Result t a b c
+ Phladiprelio.DataG: maximumElR2 :: (Foldable t2, Ord c) => t2 (Result2 a b c) -> Result2 a b c
+ Phladiprelio.DataG: maximumGroupsClassification :: (InsertLeft t2 (t a), Monoid (t2 (t a)), Ord c, InsertLeft t2 c, Monoid (t2 c), Integral d) => d -> FuncRep2 (t a) b c -> (t2 (t a), t2 (t a)) -> (t2 (t a), t2 (t a))
+ Phladiprelio.DataG: maximumGroupsClassification1 :: (InsertLeft t2 (t a), Monoid (t2 (t a)), Ord c, InsertLeft t2 c, Monoid (t2 c), Integral d) => d -> FuncRep2 (t a) b c -> t2 (t a) -> (t2 (t a), t2 (t a))
+ Phladiprelio.DataG: maximumGroupsClassification12 :: (InsertLeft t2 a, Monoid (t2 a), Ord c, InsertLeft t2 c, Monoid (t2 c), Integral d) => d -> FuncRep2 a b c -> t2 a -> (t2 a, t2 a)
+ Phladiprelio.DataG: maximumGroupsClassification2 :: (InsertLeft t2 a, Monoid (t2 a), Ord c, InsertLeft t2 c, Monoid (t2 c), Integral d) => d -> FuncRep2 a b c -> (t2 a, t2 a) -> (t2 a, t2 a)
+ Phladiprelio.DataG: 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 -> t2 (Result t a b c) -> (t2 (Result t a b c), t2 (Result t a b c))
+ Phladiprelio.DataG: 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 -> (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_2 :: (InsertLeft t2 (Result2 a b c), Monoid (t2 (Result2 a b c)), Ord c, InsertLeft t2 c, Monoid (t2 c), Integral d) => d -> (t2 (Result2 a b c), t2 (Result2 a b c)) -> (t2 (Result2 a b c), t2 (Result2 a b c))
+ Phladiprelio.DataG: maximumGroupsClassificationR_2 :: (InsertLeft t2 (Result2 a b c), Monoid (t2 (Result2 a b c)), InsertLeft t2 c, Monoid (t2 c), Ord c, Integral d) => d -> t2 (Result2 a b c) -> (t2 (Result2 a b c), t2 (Result2 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: minMaximumElRs2 :: (InsertLeft t2 (Result2 a b c), Monoid (t2 (Result2 a b c)), Ord a, Ord b, Ord c) => t2 (Result2 a b c) -> (Result2 a b c, Result2 a b c)
+ Phladiprelio.DataG: minMaximumEls :: (InsertLeft t2 (t a), Monoid (t2 (t a)), Ord (t a), Ord c) => FuncRep2 (t a) b c -> t2 (t a) -> (Result t a b c, Result t a b c)
+ Phladiprelio.DataG: minMaximumEls2 :: (InsertLeft t2 a, Monoid (t2 a), Ord a, Ord c) => FuncRep2 a b c -> t2 a -> (Result2 a b c, Result2 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.DataG: partiR2 :: (InsertLeft t2 (Result2 a b c), Monoid (t2 (Result2 a b c)), InsertLeft t2 c) => (c -> Bool) -> t2 (Result2 a b c) -> (t2 (Result2 a b c), t2 (Result2 a b c))
+ Phladiprelio.DataG: toPropertiesF' :: FuncRep2 (t a) b c -> t a -> b
+ Phladiprelio.DataG: toPropertiesF'2 :: FuncRep2 a b c -> a -> b
+ Phladiprelio.DataG: toResultR :: FuncRep2 (t a) b c -> t a -> Result t a b c
+ Phladiprelio.DataG: toResultR2 :: FuncRep2 a b c -> a -> Result2 a b c
+ Phladiprelio.DataG: toTransPropertiesF' :: FuncRep2 (t a) b c -> t a -> c
+ Phladiprelio.DataG: toTransPropertiesF'2 :: FuncRep2 a b c -> a -> c
+ Phladiprelio.Partir: class Foldable t => ConstraintsG t a
+ Phladiprelio.Partir: decodeCDouble :: ConstraintsG t a => t a -> Double -> Bool
+ Phladiprelio.Partir: instance Phladiprelio.Partir.ConstraintsG [] GHC.Types.Char
+ Phladiprelio.Partir: partitioningR :: (InsertLeft t2 (Result [] Char b Double), Monoid (t2 (Result [] Char b Double)), InsertLeft t2 Double, Monoid (t2 Double)) => String -> t2 (Result [] Char b Double) -> (t2 (Result [] Char b Double), t2 (Result [] Char b Double))
+ Phladiprelio.Partir: partitioningR2 :: (InsertLeft t2 (Result2 a b Double), Monoid (t2 (Result2 a b Double)), InsertLeft t2 Double, Monoid (t2 Double)) => String -> t2 (Result2 a b Double) -> (t2 (Result2 a b Double), t2 (Result2 a b Double))
+ Phladiprelio.StrictVG: uniquenessVariants2GNBL :: (Eq a, Foldable t, InsertLeft t a, Monoid (t a), Monoid (t (t a))) => a -> (t a -> [a]) -> (t (t a) -> [[a]]) -> ([a] -> t a) -> [Array Int Int] -> t (t a) -> [t a]
+ Phladiprelio.StrictVG: uniquenessVariants2GNPBL :: (Eq a, Foldable t, InsertLeft t a, Monoid (t a), Monoid (t (t a))) => t a -> t a -> a -> (t a -> [a]) -> (t (t a) -> [[a]]) -> ([a] -> t a) -> [Array Int Int] -> t (t a) -> [t a]
Files
- CHANGELOG.md +4/−0
- LICENSE +1/−1
- Phladiprelio/DataG.hs +282/−0
- Phladiprelio/Partir.hs +77/−0
- Phladiprelio/StrictVG.hs +57/−0
- Phonetic/Languages/Simplified/DataG/Base.hs +0/−281
- Phonetic/Languages/Simplified/DataG/Partir.hs +0/−74
- Phonetic/Languages/Simplified/StrictVG/Base.hs +0/−56
- phonetic-languages-simplified-base.cabal +5/−5
CHANGELOG.md view
@@ -59,3 +59,7 @@ * Sixth version revised A. Updated the dependencies boundaries to use the new functionality. +## 0.7.0.0 -- 2023-02-01++* Seventh version. Switched to NoImplicitPrelude extension. Changed the names of the modules. Updated the dependencies boundaries.+
LICENSE view
@@ -1,4 +1,4 @@-Copyright (c) 2020-2022 OleksandrZhabenko+Copyright (c) 2020-2023 Oleksandr Zhabenko Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
+ Phladiprelio/DataG.hs view
@@ -0,0 +1,282 @@+{-# OPTIONS_HADDOCK show-extensions #-}++-- |+-- Module : Phladiprelio.DataG+-- Copyright : (c) Oleksandr Zhabenko 2020-2023+-- License : MIT+-- Stability : Experimental+-- Maintainer : oleksandr.zhabenko@yahoo.com+--+-- Simplified version of the @phonetic-languages-common@ and @phonetic-languages-general@ packages.+-- Uses less dependencies.++{-# LANGUAGE BangPatterns, FlexibleContexts, NoImplicitPrelude #-}++module Phladiprelio.DataG where++import GHC.Base+import GHC.Num ((-))+import GHC.Real+import qualified Data.Foldable as F+import Data.SubG+import Data.MinMax.Preconditions+import Phladiprelio.Basis++maximumEl+ :: (F.Foldable t2, Ord c) => FuncRep2 (t a) b c+ -> t2 (t a)+ -> Result t a b c+maximumEl !frep2 data0 =+ 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+ -> t2 (t a)+ -> (Result t a b c,Result t a b c)+minMaximumEls !frep2 data0 =+ let (!ln,!lx) = minMax11ByC (\x y -> compare (getAC frep2 x) (getAC frep2 y)) data0+ !mn = getAB frep2 ln+ !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+ :: (F.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 #-}++-----------------------------------------------------------------------------------++-- | The second argument must be not empty for the function to work correctly.+innerPartitioning+ :: (InsertLeft t2 (t a), Monoid (t2 (t a)), InsertLeft t2 c, Monoid (t2 c), Ord c) => FuncRep2 (t a) b c+ -> t2 (t a)+ -> (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 first argument must be not empty for the function to work correctly.+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))+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+ -> FuncRep2 (t a) b c+ -> (t2 (t a), t2 (t a))+ -> (t2 (t a), t2 (t a))+maximumGroupsClassification !nGroups !frep2 (dataT,dataF)+ | F.null dataF = (dataT,mempty)+ | 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+ -> FuncRep2 (t a) b c+ -> t2 (t a)+ -> (t2 (t a), t2 (t a))+maximumGroupsClassification1 !nGroups !frep2 data0+ | 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+ -> (t2 (Result t a b c), t2 (Result t a b c))+ -> (t2 (Result t a b c), t2 (Result t a b c))+maximumGroupsClassificationR2 !nGroups (dataT,dataF)+ | F.null dataF = (dataT,mempty)+ | 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+ -> t2 (Result t a b c)+ -> (t2 (Result t a b c), t2 (Result t a b c))+maximumGroupsClassificationR !nGroups dataR+ | F.null dataR = (mempty,mempty)+ | nGroups <= 0 = innerPartitioningR dataR+ | otherwise = maximumGroupsClassificationR2 (nGroups - 1) . innerPartitioningR $ dataR+{-# NOINLINE maximumGroupsClassificationR #-}++toResultR+ :: FuncRep2 (t a) b c+ -> t a+ -> Result t a b c+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' #-}++-- | The second argument must be not empty for the function to work correctly.+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))+partiR p dataR = partitionG (p . transPropertiesF) dataR+{-# INLINE partiR #-}++-----------------------------------------------------------++maximumEl2+ :: (F.Foldable t2, Ord c) => FuncRep2 a b c+ -> t2 a+ -> Result2 a b c+maximumEl2 !frep2 data0 =+ let !l = F.maximumBy (\x y -> compare (getAC frep2 x) (getAC frep2 y)) data0+ !m = getAB frep2 l+ !tm = getBC frep2 m in R2 {line2 = l, propertiesF2 = m, transPropertiesF2 = tm}+{-# INLINE maximumEl2 #-}++minMaximumEls2+ :: (InsertLeft t2 a, Monoid (t2 a), Ord a, Ord c) => FuncRep2 a b c+ -> t2 a+ -> (Result2 a b c,Result2 a b c)+minMaximumEls2 !frep2 data0 =+ let (!ln,!lx) = minMax11ByC (\x y -> compare (getAC frep2 x) (getAC frep2 y)) data0+ !mn = getAB frep2 ln+ !mx = getAB frep2 lx+ !tmn = getBC frep2 mn+ !tmx = getBC frep2 mx in (R2 {line2 = ln, propertiesF2 = mn, transPropertiesF2 = tmn}, R2 {line2 = lx, propertiesF2 = mx, transPropertiesF2 = tmx})+{-# INLINE minMaximumEls2 #-}++maximumElR2+ :: (F.Foldable t2, Ord c) => t2 (Result2 a b c)+ -> Result2 a b c+maximumElR2 = F.maximumBy (\x y -> compare (transPropertiesF2 x) (transPropertiesF2 y))+{-# INLINE maximumElR2 #-}++minMaximumElRs2+ :: (InsertLeft t2 (Result2 a b c), Monoid (t2 (Result2 a b c)), Ord a, Ord b, Ord c) => t2 (Result2 a b c)+ -> (Result2 a b c,Result2 a b c)+minMaximumElRs2 = minMax11ByC (\x y -> compare (transPropertiesF2 x) (transPropertiesF2 y))+{-# INLINE minMaximumElRs2 #-}++-----------------------------------------------------------------------------------++-- | The second argument must be not empty for the function to work correctly.+innerPartitioning2+ :: (InsertLeft t2 a, Monoid (t2 a), InsertLeft t2 c, Monoid (t2 c), Ord c) => FuncRep2 a b c+ -> t2 a+ -> (t2 a, t2 a)+innerPartitioning2 !frep2 data0 =+ let !l = F.maximum . mapG (toTransPropertiesF'2 frep2) $ data0 in partitionG ((== l) . getAC frep2) data0+{-# INLINE innerPartitioning2 #-}++-- | The first argument must be not empty for the function to work correctly.+innerPartitioningR2+ :: (InsertLeft t2 (Result2 a b c), Monoid (t2 (Result2 a b c)), InsertLeft t2 c, Monoid (t2 c), Ord c) => t2 (Result2 a b c)+ -> (t2 (Result2 a b c), t2 (Result2 a b c))+innerPartitioningR2 dataR =+ let !l = F.maximum . mapG transPropertiesF2 $ dataR in partitionG ((== l) . transPropertiesF2) dataR+{-# INLINE innerPartitioningR2 #-}++maximumGroupsClassification2+ :: (InsertLeft t2 a, Monoid (t2 a), Ord c, InsertLeft t2 c, Monoid (t2 c), Integral d) => d+ -> FuncRep2 a b c+ -> (t2 a, t2 a)+ -> (t2 a, t2 a)+maximumGroupsClassification2 !nGroups !frep2 (dataT,dataF)+ | F.null dataF = (dataT,mempty)+ | nGroups <= 0 = (dataT,dataF)+ | otherwise = maximumGroupsClassification2 (nGroups - 1) frep2 (dataT `mappend` partT,partF)+ where (!partT,!partF) = innerPartitioning2 frep2 dataF+{-# NOINLINE maximumGroupsClassification2 #-}++maximumGroupsClassification12+ :: (InsertLeft t2 a, Monoid (t2 a), Ord c, InsertLeft t2 c, Monoid (t2 c), Integral d) => d+ -> FuncRep2 a b c+ -> t2 a+ -> (t2 a, t2 a)+maximumGroupsClassification12 !nGroups !frep2 data0+ | F.null data0 = (mempty,mempty)+ | nGroups <= 0 = innerPartitioning2 frep2 data0+ | otherwise = maximumGroupsClassification2 (nGroups - 1) frep2 . innerPartitioning2 frep2 $ data0+{-# NOINLINE maximumGroupsClassification12 #-}++maximumGroupsClassificationR2_2+ :: (InsertLeft t2 (Result2 a b c), Monoid (t2 (Result2 a b c)), Ord c, InsertLeft t2 c, Monoid (t2 c), Integral d) => d+ -> (t2 (Result2 a b c), t2 (Result2 a b c))+ -> (t2 (Result2 a b c), t2 (Result2 a b c))+maximumGroupsClassificationR2_2 !nGroups (dataT,dataF)+ | F.null dataF = (dataT,mempty)+ | nGroups <= 0 = (dataT,dataF)+ | otherwise = maximumGroupsClassificationR2_2 (nGroups - 1) (dataT `mappend` partT,partF)+ where (!partT,!partF) = innerPartitioningR2 dataF+{-# NOINLINE maximumGroupsClassificationR2_2 #-}++maximumGroupsClassificationR_2+ :: (InsertLeft t2 (Result2 a b c), Monoid (t2 (Result2 a b c)), InsertLeft t2 c, Monoid (t2 c), Ord c, Integral d) => d+ -> t2 (Result2 a b c)+ -> (t2 (Result2 a b c), t2 (Result2 a b c))+maximumGroupsClassificationR_2 !nGroups dataR+ | F.null dataR = (mempty,mempty)+ | nGroups <= 0 = innerPartitioningR2 dataR+ | otherwise = maximumGroupsClassificationR2_2 (nGroups - 1) . innerPartitioningR2 $ dataR+{-# NOINLINE maximumGroupsClassificationR_2 #-}++toResultR2+ :: FuncRep2 a b c+ -> a+ -> Result2 a b c+toResultR2 !frep2 !y = R2 { line2 = y, propertiesF2 = m, transPropertiesF2 = tm}+ where !m = getAB frep2 y+ !tm = getBC frep2 m+{-# INLINE toResultR2 #-}++toPropertiesF'2+ :: FuncRep2 a b c+ -> a+ -> b+toPropertiesF'2 !frep2 !y = getAB frep2 y+{-# INLINE toPropertiesF'2 #-}++toTransPropertiesF'2+ :: FuncRep2 a b c+ -> a+ -> c+toTransPropertiesF'2 !frep2 !y = getAC frep2 y+{-# INLINE toTransPropertiesF'2 #-}++-- | The second argument must be not empty for the function to work correctly.+partiR2+ :: (InsertLeft t2 (Result2 a b c), Monoid (t2 (Result2 a b c)), InsertLeft t2 c) => (c -> Bool)+ -> t2 (Result2 a b c)+ -> (t2 (Result2 a b c), t2 (Result2 a b c))+partiR2 p dataR = partitionG (p . transPropertiesF2) dataR+{-# INLINE partiR2 #-}+
+ Phladiprelio/Partir.hs view
@@ -0,0 +1,77 @@+{-# OPTIONS_HADDOCK show-extensions #-}++-- |+-- Module : Phladiprelio.Partir+-- Copyright : (c) Oleksandr Zhabenko 2022-2023+-- License : MIT+-- Stability : Experimental+-- Maintainer : oleksandr.zhabenko@yahoo.com+--+-- ++{-# LANGUAGE BangPatterns, FlexibleContexts, MultiParamTypeClasses, NoImplicitPrelude #-}++module Phladiprelio.Partir where++import GHC.Base+import GHC.Num+import GHC.Real+import GHC.Float+import qualified Data.Foldable as F+import Data.SubG+import Data.MinMax.Preconditions+import Phladiprelio.DataG+import Phladiprelio.Basis+import Data.Char (isDigit)+import Data.List (uncons, filter, null)+import Data.Maybe (fromJust, fromMaybe)+import Text.Read (readMaybe)++class F.Foldable t => ConstraintsG t a where+ decodeCDouble :: t a -> Double -> Bool++instance ConstraintsG [] Char where+ decodeCDouble xs !y+ | null xxs = True+ | t < '2' = (if t == '0' then (>) else (<)) y (fromIntegral . fromMaybe 1 $ (readMaybe ts :: Maybe Integer))+ | otherwise = getScale c cs t y+ where xxs = filter isDigit xs+ (t,ts) = fromJust . uncons $ xxs+ (c,cs) = fromMaybe ('0',"1") . uncons $ ts+ getScale c0 ws t0 y0 + | c0 == '1' = (ords t0) (logBase 10 y0) base+ | c0 == '2' = (ords t0) (637.0 * atan y0) base -- atan Infinity * 637.0 \approx 1000.0+ | c0 == '3' = (ords t0) (sin (k * y0)) (0.01 * base1)+ | c0 == '4' = (ords t0) (cos (k * y0)) (0.01 * base1)+ | c0 == '5' = (ords t0) (sin (k * y0)) (0.001 * base2)+ | c0 == '6' = (ords t0) (cos (k * y0)) (0.001 * base2)+ | c0 == '7' = (ords t0) (sin (k * y0)) (-0.01 * base1)+ | c0 == '8' = (ords t0) (cos (k * y0)) (-0.01 * base1)+ | otherwise = (ords t0) (y0 ** k) base1+ where base = fromIntegral . fromMaybe 1 $ (readMaybe ws :: Maybe Integer)+ ords t0+ | t0 == '2' = (>)+ | otherwise = (<)+ (w,wws) = fromMaybe ('2',"") . uncons $ ws+ base1 = fromIntegral . fromMaybe 50 $ (readMaybe wws :: Maybe Integer)+ base2 = fromIntegral . fromMaybe 500 $ (readMaybe wws :: Maybe Integer)+ k = fromIntegral . fromMaybe 2 $ (readMaybe [w] :: Maybe Integer)+ +partitioningR+ :: (InsertLeft t2 (Result [] Char b Double), Monoid (t2 (Result [] Char b Double)), InsertLeft t2 Double, Monoid (t2 Double)) => String+ -> t2 (Result [] Char b Double)+ -> (t2 (Result [] Char b Double), t2 (Result [] Char b Double))+partitioningR !xs dataR+ | F.null dataR = (mempty,mempty)+ | otherwise = partiR (decodeCDouble xs) dataR+{-# INLINABLE partitioningR #-}++partitioningR2+ :: (InsertLeft t2 (Result2 a b Double), Monoid (t2 (Result2 a b Double)), InsertLeft t2 Double, Monoid (t2 Double)) => String+ -> t2 (Result2 a b Double)+ -> (t2 (Result2 a b Double), t2 (Result2 a b Double))+partitioningR2 !xs dataR+ | F.null dataR = (mempty,mempty)+ | otherwise = partiR2 (decodeCDouble xs) dataR+{-# INLINABLE partitioningR2 #-}+
+ Phladiprelio/StrictVG.hs view
@@ -0,0 +1,57 @@+{-# OPTIONS_HADDOCK show-extensions #-}++-- |+-- Module : Phladiprelio.StrictVG+-- Copyright : (c) Oleksandr Zhabenko 2020-2023+-- License : MIT+-- Stability : Experimental+-- Maintainer : oleksandr.zhabenko@yahoo.com+--+-- Simplified version of the @phonetic-languages-common@ package.+-- Uses less dependencies.++{-# LANGUAGE BangPatterns, NoImplicitPrelude #-}++module Phladiprelio.StrictVG (+ -- * Working with lists+ uniquenessVariants2GNBL+ , uniquenessVariants2GNPBL+) where++import GHC.Base+import GHC.Num ((-))+import Phladiprelio.PermutationsArr+import qualified Data.Foldable as F+import Data.SubG+import GHC.Arr++uniquenessVariants2GNBL ::+ (Eq a, F.Foldable t, InsertLeft t a, Monoid (t a), Monoid (t (t a))) => a -- ^ The first most common element in the \"whitespace symbols\" structure+ -> (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 so 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 8).+ -> t (t a) -- ^ Must be obtained as 'subG' @whspss xs@+ -> [t a]+uniquenessVariants2GNBL !hd f1 f2 f3 perms !subs = uniquenessVariants2GNPBL mempty mempty hd f1 f2 f3 perms subs+{-# INLINE uniquenessVariants2GNBL #-}++uniquenessVariants2GNPBL ::+ (Eq a, F.Foldable t, InsertLeft t a, Monoid (t a), Monoid (t (t a))) => t a+ -> t a+ -> a -- ^ The first most common element in the whitespace symbols structure+ -> (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 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 = map f3 ns+ where !uss = (hd %@ us) %^ mempty+ !base0 = map (hd %@) . f2 $ subs+ !l = F.length base0+ !baseArr = listArray (0,l - 1) base0+ !ns = universalSetGL ts uss f1 f2 perms baseArr -- in map f3 ns+{-# INLINE uniquenessVariants2GNPBL #-}
− Phonetic/Languages/Simplified/DataG/Base.hs
@@ -1,281 +0,0 @@-{-# OPTIONS_HADDOCK show-extensions #-}---- |--- Module : Phonetic.Languages.Simplified.DataG.Base--- Copyright : (c) OleksandrZhabenko 2020-2022--- License : MIT--- Stability : Experimental--- Maintainer : olexandr543@yahoo.com------ Simplified version of the @phonetic-languages-common@ and @phonetic-languages-general@ packages.--- Uses less dependencies.--{-# LANGUAGE BangPatterns, FlexibleContexts #-}--module Phonetic.Languages.Simplified.DataG.Base where--import qualified Data.Foldable as F-import Data.Monoid-import Data.SubG-import Data.MinMax.Preconditions-import Phonetic.Languages.Basis--maximumEl- :: (Foldable t2, Ord c) => FuncRep2 (t a) b c- -> t2 (t a)- -> Result t a b c-maximumEl !frep2 data0 =- 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- -> t2 (t a)- -> (Result t a b c,Result t a b c)-minMaximumEls !frep2 data0 =- let (!ln,!lx) = minMax11ByC (\x y -> compare (getAC frep2 x) (getAC frep2 y)) data0- !mn = getAB frep2 ln- !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 #-}----------------------------------------------------------------------------------------- | The second argument must be not empty for the function to work correctly.-innerPartitioning- :: (InsertLeft t2 (t a), Monoid (t2 (t a)), InsertLeft t2 c, Monoid (t2 c), Ord c) => FuncRep2 (t a) b c- -> t2 (t a)- -> (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 first argument must be not empty for the function to work correctly.-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))-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- -> FuncRep2 (t a) b c- -> (t2 (t a), t2 (t a))- -> (t2 (t a), t2 (t a))-maximumGroupsClassification !nGroups !frep2 (dataT,dataF)- | F.null dataF = (dataT,mempty)- | 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- -> FuncRep2 (t a) b c- -> t2 (t a)- -> (t2 (t a), t2 (t a))-maximumGroupsClassification1 !nGroups !frep2 data0- | 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- -> (t2 (Result t a b c), t2 (Result t a b c))- -> (t2 (Result t a b c), t2 (Result t a b c))-maximumGroupsClassificationR2 !nGroups (dataT,dataF)- | F.null dataF = (dataT,mempty)- | 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- -> t2 (Result t a b c)- -> (t2 (Result t a b c), t2 (Result t a b c))-maximumGroupsClassificationR !nGroups dataR- | F.null dataR = (mempty,mempty)- | nGroups <= 0 = innerPartitioningR dataR- | otherwise = maximumGroupsClassificationR2 (nGroups - 1) . innerPartitioningR $ dataR-{-# NOINLINE maximumGroupsClassificationR #-}--toResultR- :: FuncRep2 (t a) b c- -> t a- -> Result t a b c-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' #-}---- | The second argument must be not empty for the function to work correctly.-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))-partiR p dataR = partitionG (p . transPropertiesF) dataR-{-# INLINE partiR #-}---------------------------------------------------------------maximumEl2- :: (Foldable t2, Ord c) => FuncRep2 a b c- -> t2 a- -> Result2 a b c-maximumEl2 !frep2 data0 =- let !l = F.maximumBy (\x y -> compare (getAC frep2 x) (getAC frep2 y)) data0- !m = getAB frep2 l- !tm = getBC frep2 m in R2 {line2 = l, propertiesF2 = m, transPropertiesF2 = tm}-{-# INLINE maximumEl2 #-}--minMaximumEls2- :: (InsertLeft t2 a, Monoid (t2 a), Ord a, Ord c) => FuncRep2 a b c- -> t2 a- -> (Result2 a b c,Result2 a b c)-minMaximumEls2 !frep2 data0 =- let (!ln,!lx) = minMax11ByC (\x y -> compare (getAC frep2 x) (getAC frep2 y)) data0- !mn = getAB frep2 ln- !mx = getAB frep2 lx- !tmn = getBC frep2 mn- !tmx = getBC frep2 mx in (R2 {line2 = ln, propertiesF2 = mn, transPropertiesF2 = tmn}, R2 {line2 = lx, propertiesF2 = mx, transPropertiesF2 = tmx})-{-# INLINE minMaximumEls2 #-}--maximumElR2- :: (Foldable t2, Ord c) => t2 (Result2 a b c)- -> Result2 a b c-maximumElR2 = F.maximumBy (\x y -> compare (transPropertiesF2 x) (transPropertiesF2 y))-{-# INLINE maximumElR2 #-}--minMaximumElRs2- :: (InsertLeft t2 (Result2 a b c), Monoid (t2 (Result2 a b c)), Ord a, Ord b, Ord c) => t2 (Result2 a b c)- -> (Result2 a b c,Result2 a b c)-minMaximumElRs2 = minMax11ByC (\x y -> compare (transPropertiesF2 x) (transPropertiesF2 y))-{-# INLINE minMaximumElRs2 #-}----------------------------------------------------------------------------------------- | The second argument must be not empty for the function to work correctly.-innerPartitioning2- :: (InsertLeft t2 a, Monoid (t2 a), InsertLeft t2 c, Monoid (t2 c), Ord c) => FuncRep2 a b c- -> t2 a- -> (t2 a, t2 a)-innerPartitioning2 !frep2 data0 =- let !l = F.maximum . mapG (toTransPropertiesF'2 frep2) $ data0 in partitionG ((== l) . getAC frep2) data0-{-# INLINE innerPartitioning2 #-}---- | The first argument must be not empty for the function to work correctly.-innerPartitioningR2- :: (InsertLeft t2 (Result2 a b c), Monoid (t2 (Result2 a b c)), InsertLeft t2 c, Monoid (t2 c), Ord c) => t2 (Result2 a b c)- -> (t2 (Result2 a b c), t2 (Result2 a b c))-innerPartitioningR2 dataR =- let !l = F.maximum . mapG transPropertiesF2 $ dataR in partitionG ((== l) . transPropertiesF2) dataR-{-# INLINE innerPartitioningR2 #-}--maximumGroupsClassification2- :: (InsertLeft t2 a, Monoid (t2 a), Ord c, InsertLeft t2 c, Monoid (t2 c), Integral d) => d- -> FuncRep2 a b c- -> (t2 a, t2 a)- -> (t2 a, t2 a)-maximumGroupsClassification2 !nGroups !frep2 (dataT,dataF)- | F.null dataF = (dataT,mempty)- | nGroups <= 0 = (dataT,dataF)- | otherwise = maximumGroupsClassification2 (nGroups - 1) frep2 (dataT `mappend` partT,partF)- where (!partT,!partF) = innerPartitioning2 frep2 dataF-{-# NOINLINE maximumGroupsClassification2 #-}--maximumGroupsClassification12- :: (InsertLeft t2 a, Monoid (t2 a), Ord c, InsertLeft t2 c, Monoid (t2 c), Integral d) => d- -> FuncRep2 a b c- -> t2 a- -> (t2 a, t2 a)-maximumGroupsClassification12 !nGroups !frep2 data0- | F.null data0 = (mempty,mempty)- | nGroups <= 0 = innerPartitioning2 frep2 data0- | otherwise = maximumGroupsClassification2 (nGroups - 1) frep2 . innerPartitioning2 frep2 $ data0-{-# NOINLINE maximumGroupsClassification12 #-}--maximumGroupsClassificationR2_2- :: (InsertLeft t2 (Result2 a b c), Monoid (t2 (Result2 a b c)), Ord c, InsertLeft t2 c, Monoid (t2 c), Integral d) => d- -> (t2 (Result2 a b c), t2 (Result2 a b c))- -> (t2 (Result2 a b c), t2 (Result2 a b c))-maximumGroupsClassificationR2_2 !nGroups (dataT,dataF)- | F.null dataF = (dataT,mempty)- | nGroups <= 0 = (dataT,dataF)- | otherwise = maximumGroupsClassificationR2_2 (nGroups - 1) (dataT `mappend` partT,partF)- where (!partT,!partF) = innerPartitioningR2 dataF-{-# NOINLINE maximumGroupsClassificationR2_2 #-}--maximumGroupsClassificationR_2- :: (InsertLeft t2 (Result2 a b c), Monoid (t2 (Result2 a b c)), InsertLeft t2 c, Monoid (t2 c), Ord c, Integral d) => d- -> t2 (Result2 a b c)- -> (t2 (Result2 a b c), t2 (Result2 a b c))-maximumGroupsClassificationR_2 !nGroups dataR- | F.null dataR = (mempty,mempty)- | nGroups <= 0 = innerPartitioningR2 dataR- | otherwise = maximumGroupsClassificationR2_2 (nGroups - 1) . innerPartitioningR2 $ dataR-{-# NOINLINE maximumGroupsClassificationR_2 #-}--toResultR2- :: FuncRep2 a b c- -> a- -> Result2 a b c-toResultR2 !frep2 !y = R2 { line2 = y, propertiesF2 = m, transPropertiesF2 = tm}- where !m = getAB frep2 y- !tm = getBC frep2 m-{-# INLINE toResultR2 #-}--toPropertiesF'2- :: FuncRep2 a b c- -> a- -> b-toPropertiesF'2 !frep2 !y = getAB frep2 y-{-# INLINE toPropertiesF'2 #-}--toTransPropertiesF'2- :: FuncRep2 a b c- -> a- -> c-toTransPropertiesF'2 !frep2 !y = getAC frep2 y-{-# INLINE toTransPropertiesF'2 #-}---- | The second argument must be not empty for the function to work correctly.-partiR2- :: (InsertLeft t2 (Result2 a b c), Monoid (t2 (Result2 a b c)), InsertLeft t2 c) => (c -> Bool)- -> t2 (Result2 a b c)- -> (t2 (Result2 a b c), t2 (Result2 a b c))-partiR2 p dataR = partitionG (p . transPropertiesF2) dataR-{-# INLINE partiR2 #-}--
− Phonetic/Languages/Simplified/DataG/Partir.hs
@@ -1,74 +0,0 @@-{-# OPTIONS_HADDOCK show-extensions #-}---- |--- Module : Phonetic.Languages.Simplified.DataG.Partir--- Copyright : (c) OleksandrZhabenko 2022--- License : MIT--- Stability : Experimental--- Maintainer : olexandr543@yahoo.com------ --{-# LANGUAGE BangPatterns, FlexibleContexts, MultiParamTypeClasses #-}--module Phonetic.Languages.Simplified.DataG.Partir where--import qualified Data.Foldable as F-import Data.Monoid-import Data.SubG-import Data.MinMax.Preconditions-import Phonetic.Languages.Simplified.DataG.Base-import Phonetic.Languages.Basis-import Data.Char (isDigit)-import Data.List (uncons)-import Data.Maybe (fromJust, fromMaybe)-import Text.Read (readMaybe)--class Foldable t => ConstraintsG t a where- decodeCDouble :: t a -> Double -> Bool--instance ConstraintsG [] Char where- decodeCDouble xs !y- | null xxs = True- | t < '2' = (if t == '0' then (>) else (<)) y (fromIntegral . fromMaybe 1 $ (readMaybe ts :: Maybe Integer))- | otherwise = getScale c cs t y- where xxs = filter isDigit xs- (t,ts) = fromJust . uncons $ xxs- (c,cs) = fromMaybe ('0',"1") . uncons $ ts- getScale c0 ws t0 y0 - | c0 == '1' = (ords t0) (logBase 10 y0) base- | c0 == '2' = (ords t0) (637.0 * atan y0) base -- atan Infinity * 637.0 \approx 1000.0- | c0 == '3' = (ords t0) (sin (k * y0)) (0.01 * base1)- | c0 == '4' = (ords t0) (cos (k * y0)) (0.01 * base1)- | c0 == '5' = (ords t0) (sin (k * y0)) (0.001 * base2)- | c0 == '6' = (ords t0) (cos (k * y0)) (0.001 * base2)- | c0 == '7' = (ords t0) (sin (k * y0)) (-0.01 * base1)- | c0 == '8' = (ords t0) (cos (k * y0)) (-0.01 * base1)- | otherwise = (ords t0) (y0 ** k) base1- where base = fromIntegral . fromMaybe 1 $ (readMaybe ws :: Maybe Integer)- ords t0- | t0 == '2' = (>)- | otherwise = (<)- (w,wws) = fromMaybe ('2',"") . uncons $ ws- base1 = fromIntegral . fromMaybe 50 $ (readMaybe wws :: Maybe Integer)- base2 = fromIntegral . fromMaybe 500 $ (readMaybe wws :: Maybe Integer)- k = fromIntegral . fromMaybe 2 $ (readMaybe [w] :: Maybe Integer)- -partitioningR- :: (InsertLeft t2 (Result [] Char b Double), Monoid (t2 (Result [] Char b Double)), InsertLeft t2 Double, Monoid (t2 Double)) => String- -> t2 (Result [] Char b Double)- -> (t2 (Result [] Char b Double), t2 (Result [] Char b Double))-partitioningR !xs dataR- | F.null dataR = (mempty,mempty)- | otherwise = partiR (decodeCDouble xs) dataR-{-# INLINABLE partitioningR #-}--partitioningR2- :: (InsertLeft t2 (Result2 a b Double), Monoid (t2 (Result2 a b Double)), InsertLeft t2 Double, Monoid (t2 Double)) => String- -> t2 (Result2 a b Double)- -> (t2 (Result2 a b Double), t2 (Result2 a b Double))-partitioningR2 !xs dataR- | F.null dataR = (mempty,mempty)- | otherwise = partiR2 (decodeCDouble xs) dataR-{-# INLINABLE partitioningR2 #-}-
− Phonetic/Languages/Simplified/StrictVG/Base.hs
@@ -1,56 +0,0 @@-{-# OPTIONS_HADDOCK show-extensions #-}---- |--- Module : Phonetic.Languages.Simplified.StrictVG.Base--- Copyright : (c) OleksandrZhabenko 2020-2021--- License : MIT--- Stability : Experimental--- Maintainer : olexandr543@yahoo.com------ Simplified version of the @phonetic-languages-common@ package.--- Uses less dependencies.--{-# LANGUAGE BangPatterns #-}--module Phonetic.Languages.Simplified.StrictVG.Base (- -- * Working with lists- uniquenessVariants2GNBL- , uniquenessVariants2GNPBL-) where--import Phonetic.Languages.Permutations.Arr-import qualified Data.Foldable as F-import Data.SubG-import GHC.Arr-import Data.Monoid--uniquenessVariants2GNBL ::- (Eq a, Foldable t, InsertLeft t a, Monoid (t a), Monoid (t (t a))) => a -- ^ The first most common element in the \"whitespace symbols\" structure- -> (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 so 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 8).- -> t (t a) -- ^ Must be obtained as 'subG' @whspss xs@- -> [t a]-uniquenessVariants2GNBL !hd f1 f2 f3 perms !subs = uniquenessVariants2GNPBL mempty mempty hd f1 f2 f3 perms subs-{-# INLINE uniquenessVariants2GNBL #-}--uniquenessVariants2GNPBL ::- (Eq a, Foldable t, InsertLeft t a, Monoid (t a), Monoid (t (t a))) => t a- -> t a- -> a -- ^ The first most common element in the whitespace symbols structure- -> (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 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 = 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-{-# INLINE uniquenessVariants2GNPBL #-}
phonetic-languages-simplified-base.cabal view
@@ -3,14 +3,14 @@ -- http://haskell.org/cabal/users-guide/ name: phonetic-languages-simplified-base-version: 0.6.1.0+version: 0.7.0.0 synopsis: A basics of the phonetic-languages functionality that can be groupped. 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 author: OleksandrZhabenko-maintainer: olexandr543@yahoo.com+maintainer: oleksandr.zhabenko@yahoo.com copyright: Oleksandr Zhabenko category: Language,Math,Game build-type: Simple@@ -18,9 +18,9 @@ cabal-version: >=1.10 library- exposed-modules: Phonetic.Languages.Simplified.DataG.Base, Phonetic.Languages.Simplified.StrictVG.Base, Phonetic.Languages.Simplified.DataG.Partir+ exposed-modules: Phladiprelio.DataG, Phladiprelio.StrictVG, Phladiprelio.Partir -- other-modules:- other-extensions: BangPatterns, FlexibleContexts, MultiParamTypeClasses- build-depends: base >=4.8 && <5, subG ==0.5.3.0, phonetic-languages-permutations-array ==0.3.4.0, phonetic-languages-basis ==0.2.0.0+ other-extensions: BangPatterns, FlexibleContexts, MultiParamTypeClasses, NoImplicitPrelude+ build-depends: base >=4.13 && <5, subG ==0.6.1.0, phonetic-languages-permutations-array ==0.4.0.0, phonetic-languages-basis ==0.3.0.0 -- hs-source-dirs: default-language: Haskell2010