packages feed

phonetic-languages-permutations (empty) → 0.1.0.0

raw patch · 5 files changed

+95/−0 lines, 5 filesdep +basedep +subGdep +subG-instancessetup-changed

Dependencies added: base, subG, subG-instances, vector

Files

+ CHANGELOG.md view
@@ -0,0 +1,5 @@+# Revision history for phonetic-languages-permutations++## 0.1.0.0 -- 2020-11-19++* First version. Released on an unsuspecting world.
+ LICENSE view
@@ -0,0 +1,20 @@+Copyright (c) 2020 OleksandrZhabenko++Permission is hereby granted, free of charge, to any person obtaining+a copy of this software and associated documentation files (the+"Software"), to deal in the Software without restriction, including+without limitation the rights to use, copy, modify, merge, publish,+distribute, sublicense, and/or sell copies of the Software, and to+permit persons to whom the Software is furnished to do so, subject to+the following conditions:++The above copyright notice and this permission notice shall be included+in all copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ Phonetic/Languages/Permutations.hs view
@@ -0,0 +1,43 @@+-- |+-- Module      :  Phonetic.Languages.Permutations+-- Copyright   :  (c) OleksandrZhabenko 2020+-- License     :  MIT+-- Stability   :  Experimental+-- Maintainer  :  olexandr543@yahoo.com+--+-- Commonly used versions of the @phonetic-languages-common@ package functions.++{-# LANGUAGE BangPatterns #-}++module Phonetic.Languages.Permutations (+  universalSetG+  , genPermutations+  , genPermutationsV+) where++import qualified Data.Vector as VB+import qualified Data.List as L (permutations)+import qualified Data.Foldable as F+import Data.SubG+import Data.SubG.InstancesPlus ()+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@.+universalSetG ::+  (Eq a, Foldable t, InsertLeft t a, Monoid (t a), Monoid (t (t a))) => t a+  -> t (t a)+  -> (t a -> VB.Vector a) -- ^ The function that is used internally to convert to the boxed 'VB.Vector' of @a@ so that the function can process further the permutations+  -> ((t (t a)) -> VB.Vector (VB.Vector a)) -- ^ The function that is used internally to convert to the boxed 'VB.Vector' of 'VB.Vector' of @a@ so that the function can process further+  -> VB.Vector (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 (VB.Vector a)+  -> VB.Vector (VB.Vector a)+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 #-}++genPermutations :: Int -> VB.Vector (VB.Vector Int)+genPermutations n = VB.map VB.fromList . VB.fromList . L.permutations . take n $ [0..]+{-# INLINE genPermutations #-}++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 #-}
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ phonetic-languages-permutations.cabal view
@@ -0,0 +1,25 @@+-- Initial phonetic-languages-permutations.cabal generated by cabal init.+-- For further documentation, see http://haskell.org/cabal/users-guide/++name:                phonetic-languages-permutations+version:             0.1.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+license:             MIT+license-file:        LICENSE+author:              OleksandrZhabenko+maintainer:          olexandr543@yahoo.com+copyright:           Oleksandr Zhabenko+category:            Language,Math,Game+build-type:          Simple+extra-source-files:  CHANGELOG.md+cabal-version:       >=1.10++library+  exposed-modules:     Phonetic.Languages.Permutations+  -- other-modules:+  other-extensions:    BangPatterns+  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