phonetic-languages-permutations 0.1.1.0 → 0.2.0.0
raw patch · 3 files changed
+32/−2 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Phonetic.Languages.Permutations: genPermutationsL :: Int -> [Vector Int]
+ Phonetic.Languages.Permutations: genPermutationsVL :: Vector [Vector Int]
+ Phonetic.Languages.Permutations: universalSetGL :: (Eq a, Foldable t, InsertLeft t a, Monoid (t a), Monoid (t (t a))) => t a -> t (t a) -> (t a -> [a]) -> (t (t a) -> [[a]]) -> [Vector Int] -> Vector [a] -> [[a]]
Files
- CHANGELOG.md +5/−0
- Phonetic/Languages/Permutations.hs +25/−0
- phonetic-languages-permutations.cabal +2/−2
CHANGELOG.md view
@@ -7,3 +7,8 @@ ## 0.1.1.0 -- 2020-11-19 * First version revised A. Some code improvements.++## 0.2.0.0 -- 2020-11-20++* Second version. Added three more functions for permutations.+
Phonetic/Languages/Permutations.hs view
@@ -9,14 +9,19 @@ module Phonetic.Languages.Permutations ( universalSetG+ , universalSetGL , genPermutations , genPermutationsV+ , genPermutationsL+ , genPermutationsVL ) where import qualified Data.Vector as VB import qualified Data.List as L (permutations) import Data.SubG import Data.SubG.InstancesPlus ()+import qualified Data.Foldable as F (concat,foldr')+--import Data.List () import Data.Monoid -- | A key point of the evaluation -- the universal set of the task represented as a 'VB.Vector' of 'VB.Vector' of @a@.@@ -31,6 +36,18 @@ universalSetG ts uss f1 f2 perms baseV = VB.map (VB.foldr' mappend mempty . VB.cons (f1 ts) . (`mappend` (f2 uss)) . VB.unsafeBackpermute baseV) perms {-# INLINE universalSetG #-} +-- | A key point of the evaluation -- the universal set of the task represented as a 'VB.Vector' of 'VB.Vector' of @a@. Because the order is not+universalSetGL ::+ (Eq a, Foldable t, InsertLeft t a, Monoid (t a), Monoid (t (t a))) => t a+ -> t (t a)+ -> (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 needed representation so that the function can process further+ -> [VB.Vector Int] -- ^ The list of permutations of 'Int' indices starting from 0 and up to n (n is probably less than 7).+ -> VB.Vector [a]+ -> [[a]]+universalSetGL ts uss f1 f2 permsL baseV = map (F.concat . F.foldr' (:) [] . (f1 ts:) . (`mappend` f2 uss) . VB.toList . VB.unsafeBackpermute baseV) permsL+{-# INLINE universalSetGL #-}+ genPermutations :: Int -> VB.Vector (VB.Vector Int) genPermutations n = VB.map VB.fromList . VB.fromList . L.permutations . take n $ [0..] {-# INLINE genPermutations #-}@@ -38,3 +55,11 @@ genPermutationsV :: VB.Vector (VB.Vector (VB.Vector Int)) genPermutationsV = VB.map (\n -> VB.map VB.fromList . VB.fromList . L.permutations . take n $ [0..]) . VB.enumFromTo 2 $ 7 {-# INLINE genPermutationsV #-}++genPermutationsL :: Int -> [VB.Vector Int]+genPermutationsL n = map VB.fromList . L.permutations . take n $ [0..]+{-# INLINE genPermutationsL #-}++genPermutationsVL :: VB.Vector [VB.Vector Int]+genPermutationsVL = VB.map (\n -> map VB.fromList . L.permutations . take n $ [0..]) . VB.enumFromTo 2 $ 7+{-# INLINE genPermutationsVL #-}
phonetic-languages-permutations.cabal view
@@ -2,7 +2,7 @@ -- For further documentation, see http://haskell.org/cabal/users-guide/ name: phonetic-languages-permutations-version: 0.1.1.0+version: 0.2.0.0 synopsis: Commonly used versions of the phonetic-languages-common package description: Permutations-related to produce universal set of the task. homepage: https://hackage.haskell.org/package/phonetic-languages-permutations@@ -19,7 +19,7 @@ library exposed-modules: Phonetic.Languages.Permutations -- other-modules:- -- other-extensions: + -- other-extensions: build-depends: base >=4.8 && <4.15, vector >=0.11 && <0.14, subG >=0.4.2 && <1, subG-instances >=0.1 && <1 -- hs-source-dirs: default-language: Haskell2010