packages feed

ogma-extra 1.6.0 → 1.7.0

raw patch · 5 files changed

+43/−6 lines, 5 filesdep ~Cabaldep ~aesondep ~textPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: Cabal, aeson, text

API changes (from Hackage documentation)

+ Data.List.Extra: stripSuffix :: String -> String -> String
+ Data.String.Extra: pascalCase :: String -> String

Files

CHANGELOG.md view
@@ -1,5 +1,13 @@ # Revision history for ogma-extra +## [1.7.0] - 2025-03-21++* Version bump 1.7.0 (#269).+* Bump upper version constraint on Cabal (#213).+* Bump upper version constraint on aeson, text (#225).+* Remove extraneous EOL character (#224).+* Add auxiliary functions to manipulate strings, lists (#256).+ ## [1.6.0] - 2025-01-21  * Version bump 1.6.0 (#208).
ogma-extra.cabal view
@@ -15,7 +15,7 @@ -- ANY OTHER APPLICATIONS RESULTING FROM USE OF THE SUBJECT SOFTWARE. FURTHER, -- GOVERNMENT AGENCY DISCLAIMS ALL WARRANTIES AND LIABILITIES REGARDING -- THIRD-PARTY SOFTWARE, IF PRESENT IN THE ORIGINAL SOFTWARE, AND DISTRIBUTES--- IT "AS IS."
+-- IT "AS IS." -- -- Waiver and Indemnity: RECIPIENT AGREES TO WAIVE ANY AND ALL CLAIMS AGAINST -- THE UNITED STATES GOVERNMENT, ITS CONTRACTORS AND SUBCONTRACTORS, AS WELL AS@@ -32,7 +32,7 @@ build-type:          Simple  name:                ogma-extra-version:             1.6.0+version:             1.7.0 homepage:            https://github.com/nasa/ogma bug-reports:         https://github.com/nasa/ogma/issues license:             OtherLicense@@ -75,13 +75,13 @@    build-depends:       base        >= 4.11.0.0 && < 5-    , aeson       >= 2.0.0.0  && < 2.2+    , aeson       >= 2.0.0.0  && < 2.3     , bytestring  >= 0.10.8.2 && < 0.13-    , Cabal       >= 2.2.0.0  && < 3.9+    , Cabal       >= 2.2.0.0  && < 3.15     , directory   >= 1.3.1.5  && < 1.4     , filepath    >= 1.4.2    && < 1.6     , microstache >= 1.0      && < 1.1-    , text        >= 1.2.3.1  && < 2.1+    , text        >= 1.2.3.1  && < 2.2    hs-source-dirs:     src
src/Data/List/Extra.hs view
@@ -31,6 +31,9 @@ -- | Auxiliary functions for working with values of type '[]'. module Data.List.Extra where +-- External imports+import Data.List ( isSuffixOf )+ -- | Safely extract the head of a list. headEither :: [a] -> Either String a headEither (a:_) = Right a@@ -45,3 +48,9 @@ toTail :: (a -> a) -> [a] -> [a] toTail f (x:xs) = x : fmap f xs toTail _ xs     = xs++-- | Remove a suffix from a string, if present.+stripSuffix :: String -> String -> String+stripSuffix suffix string+  | isSuffixOf suffix string = take (length string - length suffix) string+  | otherwise                = string
src/Data/String/Extra.hs view
@@ -34,6 +34,9 @@       -- * Safe I/O       safeReadFile +      -- * String transformation+    , pascalCase+       -- * String sanitization     , sanitizeLCIdentifier     , sanitizeUCIdentifier@@ -69,6 +72,23 @@ -- | Cannot-open-file message. strStringCannotOpenFile :: FilePath -> String strStringCannotOpenFile fp = "Error opening file: " ++ fp++-- * Transformation++-- | Convert a string with underscores to PascalCase.+pascalCase :: String -> String+pascalCase = concatMap capitalize . parts+  where+    capitalize (x:xs) = toUpper x : map toLower xs+    capitalize [] = []++    parts :: String -> [String]+    parts "" = []+    parts s =+      let (l, r) = break (== '_') s+      in l : case r of+               []     -> []+               (_:rs) -> parts rs  -- * Sanitization 
tests/Main.hs view
@@ -15,7 +15,7 @@ -- ANY OTHER APPLICATIONS RESULTING FROM USE OF THE SUBJECT SOFTWARE. FURTHER, -- GOVERNMENT AGENCY DISCLAIMS ALL WARRANTIES AND LIABILITIES REGARDING -- THIRD-PARTY SOFTWARE, IF PRESENT IN THE ORIGINAL SOFTWARE, AND DISTRIBUTES--- IT "AS IS."
+-- IT "AS IS." -- -- Waiver and Indemnity: RECIPIENT AGREES TO WAIVE ANY AND ALL CLAIMS AGAINST -- THE UNITED STATES GOVERNMENT, ITS CONTRACTORS AND SUBCONTRACTORS, AS WELL AS