phladiprelio-general-datatype 0.5.2.0 → 0.6.0.0
raw patch · 6 files changed
+26/−161 lines, 6 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- Phladiprelio.General.Datatype: D :: [Double] -> Read2
- Phladiprelio.General.Datatype: L1 :: !a -> BasicLan a
- Phladiprelio.General.Datatype: L2 :: !Double -> BasicLan a
- Phladiprelio.General.Datatype: Phl :: t a -> (t a -> t b) -> Phladiprelio t a b
- Phladiprelio.General.Datatype: S :: [Char] -> Read2
- Phladiprelio.General.Datatype: U1 :: {-# UNPACK #-} !Char -> BasicUkr
- Phladiprelio.General.Datatype: U2 :: !Double -> BasicUkr
- Phladiprelio.General.Datatype: [convF] :: Phladiprelio t a b -> t a -> t b
- Phladiprelio.General.Datatype: [inputData] :: Phladiprelio t a b -> t a
- Phladiprelio.General.Datatype: data BasicLan a
- Phladiprelio.General.Datatype: data BasicUkr
- Phladiprelio.General.Datatype: data Phladiprelio t a b
- Phladiprelio.General.Datatype: data Read2
- Phladiprelio.General.Datatype: instance GHC.Classes.Eq Phladiprelio.General.Datatype.BasicUkr
- Phladiprelio.General.Datatype: instance GHC.Classes.Eq Phladiprelio.General.Datatype.Read2
- Phladiprelio.General.Datatype: instance GHC.Classes.Eq a => GHC.Classes.Eq (Phladiprelio.General.Datatype.BasicLan a)
- Phladiprelio.General.Datatype: instance GHC.Classes.Ord Phladiprelio.General.Datatype.BasicUkr
- Phladiprelio.General.Datatype: instance GHC.Classes.Ord a => GHC.Classes.Ord (Phladiprelio.General.Datatype.BasicLan a)
- Phladiprelio.General.Datatype: instance GHC.Show.Show Phladiprelio.General.Datatype.Read2
- Phladiprelio.General.Datatype: readBasic :: (String -> [a]) -> ([a] -> [Double]) -> String -> [Double]
- Phladiprelio.General.Datatype: readBasic0 :: Double -> (String -> [a]) -> ([a] -> [Double]) -> String -> [Double]
- Phladiprelio.General.Datatype: readBasic0G :: (String -> Bool) -> Double -> (String -> [a]) -> ([a] -> [Double]) -> String -> [Double]
- Phladiprelio.General.Datatype: readBasic1G :: String -> [Read2]
- Phladiprelio.General.Datatype: readBasic2G :: (String -> Bool) -> (String -> [a]) -> ([a] -> [Double]) -> [Read2] -> [Double]
- Phladiprelio.General.Datatype: readBasic3 :: (String -> [a]) -> ([a] -> [Double]) -> String -> [Double]
- Phladiprelio.General.Datatype: readBasic3G :: (String -> Bool) -> (String -> [a]) -> ([a] -> [Double]) -> String -> [Double]
- Phladiprelio.General.Datatype: readBasic4 :: (String -> [a]) -> ([a] -> [Double]) -> (String -> [b]) -> ([b] -> [String]) -> [Read2] -> [(String, Double)]
- Phladiprelio.General.Datatype: readBasic4G :: (String -> Bool) -> (String -> [a]) -> ([a] -> [Double]) -> (String -> [b]) -> ([b] -> [String]) -> [Read2] -> [(String, Double)]
- Phladiprelio.General.Datatype: readBasicG :: (String -> Bool) -> (String -> [a]) -> ([a] -> [Double]) -> String -> [Double]
- Phladiprelio.General.Datatype: readHead :: (String -> [a]) -> ([a] -> [Double]) -> String -> Double
- Phladiprelio.General.Datatype: readU2 :: String -> Double
- Phladiprelio.General.Datatype: readU3 :: Double -> String -> Double
- Phladiprelio.General.Datatype: showDoubleAsInsert :: Double -> String
- Phladiprelio.General.Datatype: splF :: [Char] -> [[Char]]
Files
- CHANGELOG.md +4/−0
- LICENSE +1/−1
- Phladiprelio/General/Datatype.hs +0/−147
- Phladiprelio/General/Datatype3.hs +13/−6
- README.md +5/−4
- phladiprelio-general-datatype.cabal +3/−3
CHANGELOG.md view
@@ -57,3 +57,7 @@ * Fifth version revised B. Fixed issue with Phladiprelio.General.Distance.distanceSqrG2 function that led earlier to incorrect results. +## 0.6.0.0 -- 2024-01-19++* Sixth version. Removed the module Phladiprelio.General.Datatype except readU2 function that moved to the Phladiprelio.General.Datatype3 module because the removed functionality in extended version is provided by the Phladiprelio.General.Datatype3 module. To find the removed functionality, please, refer to the versions up to 0.5.2.0. Fixed issue with the readSimple3 function for '=' after just one syllable. +
LICENSE view
@@ -1,4 +1,4 @@-Copyright (c) 2023 Oleksandr Zhabenko+Copyright (c) 2023-2024 Oleksandr Zhabenko Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
− Phladiprelio/General/Datatype.hs
@@ -1,147 +0,0 @@-{-# OPTIONS_GHC -funbox-strict-fields #-}-{-# LANGUAGE NoImplicitPrelude, BangPatterns #-}--module Phladiprelio.General.Datatype where--import GHC.Base-import GHC.List-import Data.List (groupBy)-import Data.Char (isDigit, isSpace)-import Text.Read (readMaybe)-import Text.Show (Show(..))-import GHC.Num ((*))-import Data.Maybe (fromMaybe)-import Data.Tuple (snd)--data Phladiprelio t a b = Phl {- inputData :: t a,- convF :: t a -> t b-}---- | Universal data, can be used e. g. for phladiprelio-general series of packages.-data BasicLan a = L1 !a | L2 !Double deriving (Eq, Ord)---- | Specific for Ukranian data type for phladiprelio-ukrainian series of packages.-data BasicUkr = U1 {-# UNPACK #-} !Char | U2 !Double deriving (Eq, Ord)--readBasic0 - :: Double- -> (String -> [a])- -> ([a] -> [Double])- -> String - -> [Double]-readBasic0 = readBasic0G (not . null . filter (not . isSpace))--readBasic = readBasic0 1.0-{-# INLINE readBasic #-}--readBasic0G - :: (String -> Bool) -- ^ A special function to check whether the 'String' contains needed information. Must return 'True' for the 'String' that contains the needed for usual processment information, otherwise — 'False'.- -> Double- -> (String -> [a])- -> ([a] -> [Double])- -> String - -> [Double]-readBasic0G p temp fConvA fConvD xs@('_':ys) = (readU2 ws * temp) : readBasic0G p temp fConvA fConvD qs- where (ws, qs) = span isDigit ys-readBasic0G p temp fConvA fConvD xs@(_:_) - | null us = dc- | otherwise = dc `mappend` ((readU2 ws * d) : readBasic0G p d fConvA fConvD qs)- where (ts, us) = break (== '_') xs- dc - | null ts || not (p ts) = [temp]- | otherwise = fConvD . fConvA $ ts- d = last dc- vs = drop 1 us- (ws, qs) = span isDigit vs-readBasic0G _ _ _ _ _ = []--readBasicG p = readBasic0G p 1.0-{-# INLINE readBasicG #-}--readHead- :: (String -> [a])- -> ([a] -> [Double])- -> String - -> Double-readHead fConvA fConvD xs = h - where hs = fConvD . fConvA $ xs- h - | null hs = 1.0- | otherwise = head hs--splF js@(_:_) - = case span (== '_') js of- (~is,[]) -> []- ~(is, rs) -> let (bs, ds) = span isDigit rs in bs : splF ds-splF [] = []--data Read2 = D [Double] | S [Char] deriving (Eq, Show)--readBasic1G - :: String - -> [Read2]-readBasic1G xs = xss- where f xs@('_':ys) = D (map readU2 . splF $ ys)- f xs = S xs- xss = map f . groupBy (\x y -> (isDigit y || y == '_') && (isDigit x || x == '_') || not (or [isDigit x, isDigit y, x == '_', y == '_'])) $ xs--showDoubleAsInsert :: Double -> String-showDoubleAsInsert d- | d <= 0 = []- | otherwise = '_':(filter (/= '.') . show $ d)-{-# INLINE showDoubleAsInsert #-}--readBasic2G - :: (String -> Bool) -- ^ A special function to check whether the 'String' contains needed information. Must return 'True' for the 'String' that contains the needed for usual processment information, otherwise — 'False'.- -> (String -> [a])- -> ([a] -> [Double])- -> [Read2]- -> [Double]-readBasic2G p fConvA fConvD xs@(D ys:S t:ts) = map (* h) ys `mappend` readBasic2G p fConvA fConvD (S t:ts)- where h = readHead fConvA fConvD t-readBasic2G p fConvA fConvD xs@(S ys:D ts:ks) = dc `mappend` map (* l) ts `mappend` readBasic2G p fConvA fConvD ks- where dc = fConvD . fConvA $ ys- l = last dc-readBasic2G p fConvA fConvD [S ys] = fConvD . fConvA $ ys-readBasic2G _ _ _ _ = []--readBasic3G p fConvA fConvD = readBasic2G p fConvA fConvD . readBasic1G-{-# INLINABLE readBasic3G #-}--readBasic3 = readBasic3G (not . null . filter (not . isSpace))-{-# INLINABLE readBasic3 #-}---- | Is intended to be used in the "music" mode for PhLADiPreLiO.-readBasic4G - :: (String -> Bool) -- ^ A special function to check whether the 'String' contains needed information. Must return 'True' for the 'String' that contains the needed for usual processment information, otherwise — 'False'.- -> (String -> [a])- -> ([a] -> [Double])- -> (String -> [b])- -> ([b] -> [String])- -> [Read2]- -> [(String, Double)]-readBasic4G p fConvA fConvD gConvB gConvS xs@(D ys:S t:ts) = map (\y -> (showDoubleAsInsert y, y * h)) ys `mappend` readBasic4G p fConvA fConvD gConvB gConvS (S t:ts)- where h = readHead fConvA fConvD t-readBasic4G p fConvA fConvD gConvB gConvS xs@(S ys:D ts:ks) = dc `mappend` map (\y -> (showDoubleAsInsert y, y * l)) ts `mappend` readBasic4G p fConvA fConvD gConvB gConvS ks- where dc = zip (gConvS . gConvB $ ys) (fConvD . fConvA $ ys)- dl = last dc- l = snd dl-readBasic4G p fConvA fConvD gConvB gConvS [S ys] = zip (gConvS . gConvB $ ys) (fConvD . fConvA $ ys)-readBasic4G _ _ _ _ _ _ = []--readBasic4 = readBasic4G (not . null . filter (not . isSpace))-{-# INLINE readBasic4 #-}---- | Is a way to read duration of the additional added time period into the line.-readU2 :: String -> Double-readU2 xs@(y:ys) = fromMaybe 1.0 (readMaybe (y:'.':(if null ys then "0" else ys))::Maybe Double)-readU2 _ = 1.0-{-# INLINABLE readU2 #-}---- | Is a way to read duration of the additional added time period into the line.-readU3 :: Double -> String -> Double-readU3 def xs@(y:ys) = fromMaybe def (readMaybe (y:'.':(if null ys then "0" else ys))::Maybe Double)-readU3 def _ = def-{-# INLINABLE readU3 #-}-
Phladiprelio/General/Datatype3.hs view
@@ -23,8 +23,13 @@ import GHC.Num ((*),(+)) import Data.Maybe (fromMaybe) import Data.Tuple (snd)-import Phladiprelio.General.Datatype (readU2) +-- | Is a way to read duration of the additional added time period into the line.+readU2 :: String -> Double+readU2 xs@(y:ys) = fromMaybe 1.0 (readMaybe (y:'.':(if null ys then "0" else ys))::Maybe Double)+readU2 _ = 1.0+{-# INLINE readU2 #-}+ splitL0 :: String -> [String] splitL0 = groupBy (\x y -> (isDigit x && isDigit y) || (x /= '_' && x /= '=' && not (isDigit x) && y /= '_' && y /= '=' && not (isDigit y)) || ((x == '=' || x == '_') && isDigit y)) {-# INLINE splitL0 #-}@@ -66,14 +71,16 @@ -> (String -> [Double]) -> [Read0] -> [Double]-readSimple3 p temp fConvA rs@(C xs:A x:ts) = qqs `mappend` (xl : readSimple3 p xl fConvA ts)+readSimple3 p temp fConvA rs@(C xs:A x:ts) -- This branch is fixed in the version 0.6.0.0 because earlier it has an issue.+ | null qs = readSimple3 p temp fConvA ts+ | null q1 = xl1 : readSimple3 p xl1 fConvA ts+ | otherwise = q1 `mappend` (xl1 : readSimple3 p xl1 fConvA ts) where qs | p xs = fConvA xs | otherwise = []- (ql, qqs) - | null qs = (0.0,[])- | otherwise = let (q1,q2s) = splitAtEnd 1 qs in (head q1, q2s)- xl = x * ql+ (q1,q2s) = splitAtEnd 1 qs+ ql1 = head q2s+ xl1=x*ql1 readSimple3 p temp fConvA rs@(C xs:ys@(B x:ts)) = qs `mappend` qqs `mappend` readSimple3 p ql fConvA ws where (ks, ws) = span isB ys qs
README.md view
@@ -4,17 +4,18 @@ [Чому деякі рядки легко вимовляти,а інші — ні,або Просодична неспрогнозованість як характеристика тексту](https://www.academia.edu/105067723/%D0%A7%D0%BE%D0%BC%D1%83_%D0%B4%D0%B5%D1%8F%D0%BA%D1%96_%D1%80%D1%8F%D0%B4%D0%BA%D0%B8_%D0%BB%D0%B5%D0%B3%D0%BA%D0%BE_%D0%B2%D0%B8%D0%BC%D0%BE%D0%B2%D0%BB%D1%8F%D1%82%D0%B8_%D0%B0_%D1%96%D0%BD%D1%88%D1%96_%D0%BD%D1%96_%D0%B0%D0%B1%D0%BE_%D0%BF%D1%80%D0%BE%D1%81%D0%BE%D0%B4%D0%B8%D1%87%D0%BD%D0%B0_%D0%BD%D0%B5%D1%81%D0%BF%D1%80%D0%BE%D0%B3%D0%BD%D0%BE%D0%B7%D0%BE%D0%B2%D0%B0%D0%BD%D1%96%D1%81%D1%82%D1%8C_%D1%8F%D0%BA_%D1%85%D0%B0%D1%80%D0%B0%D0%BA%D1%82%D0%B5%D1%80%D0%B8%D1%81%D1%82%D0%B8%D0%BA%D0%B0_%D1%82%D0%B5%D0%BA%D1%81%D1%82%D1%83) -[English text](https://www.academia.edu/105067761/Why_some_lines_are_easy_to_pronounce_and_others_are_not_or_prosodic_unpredictability_as_a_characteristic_of_text)+[Why some lines are easy to pronounce and others are not, or prosodic unpredictability as a characteristic of text](https://www.academia.edu/105067761/Why_some_lines_are_easy_to_pronounce_and_others_are_not_or_prosodic_unpredictability_as_a_characteristic_of_text) The documentation for the old PhLADiPreLiO implementation is available at the following links.-[Новий текст теорії](https://oleksandr-zhabenko.github.io/uk/rhythmicity/phladiprelioUkr.7.pdf) -[New implementation](https://oleksandr-zhabenko.github.io/uk/rhythmicity/phladiprelioEng.7.pdf)+Ukrainian: [Більш бажані варіанти текстового рядка на основі PhLADiPreLiO з використанням Haskell — базові ідеї](https://oleksandr-zhabenko.github.io/uk/rhythmicity/phladiprelioUkr.7.pdf) +English: [Preferred line options based on the PhLADiPreLiO using Haskell](https://oleksandr-zhabenko.github.io/uk/rhythmicity/phladiprelioEng.7.pdf)+ Devotion ======== -P.S.: the author would like to devote this project to support the [Foundation Gastrostars](https://gastrostars.nl).+The author would like to devote this project to support the [Foundation Gastrostars](https://gastrostars.nl). On the 2023/09/22 there is Nathalie's Kok birthday. She is the mother of the foundation founder [Emma Kok](https://emmakok.nl) and the member of the foundation board, so the versions 0.1.0.0, 0.1.1.0, 0.2.0.0, 0.2.1.0 and 0.2.2.0 (the first, the initial ones) are also dedicated to Nathalie Kok.
phladiprelio-general-datatype.cabal view
@@ -1,9 +1,10 @@ cabal-version: 1.24 name: phladiprelio-general-datatype-version: 0.5.2.0+version: 0.6.0.0 synopsis: Extended functionality of PhLADiPreLiO description: Can be used not only for language, but also for simpler music and lyrics composing. homepage: https://hackage.haskell.org/package/phladiprelio-general-datatype+bug-reports: https://github.com/Oleksandr-Zhabenko/phladiprelio-general-datatype/issues license: MIT license-file: LICENSE@@ -13,10 +14,9 @@ category: Sound, Language, Math, Music build-type: Simple extra-doc-files: CHANGELOG.md, README.md--- extra-source-files: library- exposed-modules: Phladiprelio.General.Datatype, Phladiprelio.General.Datatype3, Phladiprelio.General.Distance+ exposed-modules: Phladiprelio.General.Datatype3, Phladiprelio.General.Distance -- other-modules: other-extensions: NoImplicitPrelude, BangPatterns ghc-options: -funbox-strict-fields