phladiprelio-general-datatype 0.2.2.0 → 0.3.0.0
raw patch · 4 files changed
+70/−4 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Phladiprelio.General.Datatype: D :: [Double] -> Read2
+ Phladiprelio.General.Datatype: S :: [Char] -> Read2
+ Phladiprelio.General.Datatype: data Read2
+ Phladiprelio.General.Datatype: instance GHC.Classes.Eq Phladiprelio.General.Datatype.Read2
+ Phladiprelio.General.Datatype: instance GHC.Show.Show Phladiprelio.General.Datatype.Read2
+ 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: readHead :: (String -> [a]) -> ([a] -> [Double]) -> String -> Double
+ Phladiprelio.General.Datatype: readU3 :: Double -> String -> Double
+ Phladiprelio.General.Datatype: splF :: [Char] -> [[Char]]
Files
- CHANGELOG.md +4/−0
- Phladiprelio/General/Datatype.hs +55/−1
- README.md +10/−2
- phladiprelio-general-datatype.cabal +1/−1
CHANGELOG.md view
@@ -21,3 +21,7 @@ * Second version revised B. Fixed issue with readBasic0G function and related ones. +## 0.3.0.0 -- 2023-10-01++* Third version. Added new datatype and functions to the library. Some documentation improvements.+
Phladiprelio/General/Datatype.hs view
@@ -5,8 +5,10 @@ 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) @@ -49,17 +51,69 @@ | null ts || not (p ts) = [temp] | otherwise = fConvD . fConvA $ ts d = last dc- vs = dropWhile (== '_') us+ 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++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 (\y -> y * 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 (\y -> y * 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 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:'.':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:'.':ys)::Maybe Double)+readU3 def _ = def+{-# INLINABLE readU3 #-}
README.md view
@@ -16,9 +16,17 @@ P.S.: 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 five first ones!) are also dedicated to Nathalie Kok.+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. -If you would like to share some financial support, please, contact the mentioned foundation+On the 01/10/2023 there are International Music Day and [André's Rieu](https://www.andrerieu.com/en) Birthday. So the version 0.11.0.0 is+additionally devoted to him as well as to the Kok family — [Emma](https://emmakok.nl) and [Enzo](https://enzokok.nl) are amazing and fantastic musicians, Vico+works with PhilZuid, Sophie sings in the classical manner. Nathalie Kok with love to her family and +appreciation for André's Rieu support also celebrates the Day. In Ukraine this day has several +important celebrations — Intercession of the Holy Theotokos (Pokrova), Cossacks' Day, Day of Defenders of Ukraine (especially relevant during the Russian war against Ukraine).++All support is welcome, including donations for the needs of the Ukrainian army, IDPs and refugees. ++If you would like to share some financial support with the Foundation Gastrostars, please, contact the mentioned foundation using the URL: [Contact Foundation GASTROSTARS](https://gastrostars.nl/hou-mij-op-de-hoogte)
phladiprelio-general-datatype.cabal view
@@ -1,6 +1,6 @@ cabal-version: 1.24 name: phladiprelio-general-datatype-version: 0.2.2.0+version: 0.3.0.0 synopsis: Extended functionality of PhLADiPreLiO description: Can be used not only for language, but also for simpler music and lyrics composing. homepage: