packages feed

himari 1.1.6.0 → 1.1.6.1

raw patch · 7 files changed

+39/−93 lines, 7 filesdep ~sydtestPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: sydtest

API changes (from Hackage documentation)

Files

.hlint.yaml view
@@ -534,86 +534,14 @@     - message: "Partial: throws on empty Seq."       name: Data.Sequence.scanr1       within: []-- hint:-    lhs: Data.Text.pack-    note: Use convert from Data.Convertible for uniform type conversion-    rhs: convert-- hint:-    lhs: Data.Text.unpack-    note: Use convert from Data.Convertible for uniform type conversion-    rhs: convert-- hint:-    lhs: Data.Text.Lazy.pack-    note: Use convert from Data.Convertible for uniform type conversion-    rhs: convert-- hint:-    lhs: Data.Text.Lazy.unpack-    note: Use convert from Data.Convertible for uniform type conversion-    rhs: convert-- hint:-    lhs: Data.Text.Lazy.toStrict-    note: Use convert from Data.Convertible for uniform type conversion-    rhs: convert-- hint:-    lhs: Data.Text.Lazy.fromStrict-    note: Use convert from Data.Convertible for uniform type conversion-    rhs: convert-- hint:-    lhs: Data.Text.Encoding.encodeUtf8-    note: Use convert from Data.Convertible for uniform type conversion-    rhs: convert-- hint:-    lhs: Data.Text.Encoding.decodeUtf8-    note: Use convert from Data.Convertible for uniform type conversion-    rhs: convert-- hint:-    lhs: Data.Text.Lazy.Encoding.encodeUtf8-    note: Use convert from Data.Convertible for uniform type conversion-    rhs: convert-- hint:-    lhs: Data.Text.Lazy.Encoding.decodeUtf8-    note: Use convert from Data.Convertible for uniform type conversion-    rhs: convert-- hint:-    lhs: Data.ByteString.pack-    note: Use convert from Data.Convertible for uniform type conversion-    rhs: convert-- hint:-    lhs: Data.ByteString.unpack-    note: Use convert from Data.Convertible for uniform type conversion-    rhs: convert-- hint:-    lhs: Data.ByteString.Lazy.pack-    note: Use convert from Data.Convertible for uniform type conversion-    rhs: convert-- hint:-    lhs: Data.ByteString.Lazy.unpack-    note: Use convert from Data.Convertible for uniform type conversion-    rhs: convert-- hint:-    lhs: Data.ByteString.Lazy.toStrict-    note: Use convert from Data.Convertible for uniform type conversion-    rhs: convert-- hint:-    lhs: Data.ByteString.Lazy.fromStrict-    note: Use convert from Data.Convertible for uniform type conversion-    rhs: convert-- hint:-    lhs: Data.Text.Lazy.Builder.fromText-    note: Use convert from Data.Convertible for uniform type conversion-    rhs: convert-- hint:-    lhs: Data.Text.Lazy.Builder.fromLazyText-    note: Use convert from Data.Convertible for uniform type conversion-    rhs: convert-- hint:-    lhs: Data.Text.Lazy.Builder.fromString-    note: Use convert from Data.Convertible for uniform type conversion-    rhs: convert-- hint:-    lhs: Data.Text.Lazy.Builder.toLazyText-    note: Use convert from Data.Convertible for uniform type conversion-    rhs: convert+- functions:+    - message: Use safeConvert from Data.Convertible to surface conversion errors as Either ConvertError instead of relying on a partial function+      name: Data.Text.Encoding.decodeUtf8+      within: []+- functions:+    - message: Use safeConvert from Data.Convertible to surface conversion errors as Either ConvertError instead of relying on a partial function+      name: Data.Text.Lazy.Encoding.decodeUtf8+      within: [] - functions:     - message: "Don't throw in pure code. Use throwM in MonadThrow context."       name: throw
CHANGELOG.md view
@@ -7,6 +7,21 @@  ## [Unreleased] +## [1.1.6.1] - 2026-07-27++### Changed++- Stop preferring `convert` over total functions+  like `pack`, `unpack`, `toStrict`, `fromStrict`, `encodeUtf8`,+  and lazy/strict `Builder` conversions,+  because `convert` can be partial depending+  on the `Convertible` instance and this project avoids partial functions+- Warn against partial conversion functions like `decodeUtf8`+  with a message that recommends `safeConvert` from `Data.Convertible`,+  which returns `Either ConvertError` so the failure can be handled as a value+  rather than thrown. The rule is a usage restriction rather than a hint,+  since `safeConvert` is not a drop-in replacement (the return type changes)+ ## [1.1.6.0] - 2026-06-16  ### Added
example/anomaly-monitor/Anomaly.hs view
@@ -5,6 +5,7 @@   , formatReport   ) where +import Data.Text qualified as T import Himari  -- | Severity level of detected anomaly.@@ -39,11 +40,11 @@   mconcat     [ "[ANOMALY DETECTED] "     , "Severity: "-    , convert $ show report.severity+    , T.pack $ show report.severity     , " | CPU: "-    , convert $ showFFloat (Just 1) report.cpuUsage "%"+    , T.pack $ showFFloat (Just 1) report.cpuUsage "%"     , " (threshold: "-    , convert $ showFFloat (Just 1) report.threshold "%"+    , T.pack $ showFFloat (Just 1) report.threshold "%"     , ") | Time: "-    , convert $ formatTime defaultTimeLocale "%Y-%m-%d %H:%M:%S UTC" report.timestamp+    , T.pack $ formatTime defaultTimeLocale "%Y-%m-%d %H:%M:%S UTC" report.timestamp     ]
example/anomaly-monitor/Config.hs view
@@ -9,6 +9,7 @@   , loadConfig   ) where +import Data.Text qualified as T import Exception import Himari @@ -42,8 +43,8 @@     logInfoN "No config file specified, using defaults"     pure def   Just path -> do-    logInfoN $ "Loading config from: " <> convert path+    logInfoN $ "Loading config from: " <> T.pack path     contentEither <- liftIO $ eitherDecodeFileStrict path     case contentEither of-      Left exception -> throwM . ConfigDecodeException $ convert exception+      Left exception -> throwM . ConfigDecodeException $ T.pack exception       Right config' -> pure config'
example/anomaly-monitor/Cpu.hs view
@@ -81,7 +81,7 @@   contentEither <- tryAny . liftIO $ T.readFile "/proc/stat"   case contentEither of     Left exception -> do-      logWarnN $ "Failed to read /proc/stat: " <> convert (displayException exception)+      logWarnN $ "Failed to read /proc/stat: " <> T.pack (displayException exception)       pure Nothing     Right content -> pure $ parseCpuStats content @@ -91,9 +91,9 @@   config' <- view config   return $     "Configuration: CPU threshold = "-      <> convert (showFFloat (Just 1) (config' ^. cpuThreshold) "%")+      <> T.pack (showFFloat (Just 1) (config' ^. cpuThreshold) "%")       <> ", interval = "-      <> convert (show $ config' ^. checkInterval)+      <> T.pack (show $ config' ^. checkInterval)       <> "s"       <> ", max checks = "-      <> convert (show $ config' ^. maxChecks)+      <> T.pack (show $ config' ^. maxChecks)
example/anomaly-monitor/Loop.hs view
@@ -5,6 +5,7 @@ import Anomaly import Config import Cpu+import Data.Text qualified as T import Env import Himari @@ -37,7 +38,7 @@         formattedReport <- mkFormattedReport usage cpuThreshold' severity'         -- Log based on severity         case severity' of-          Normal -> logDebugN $ "System normal. CPU: " <> convert (showFFloat (Just 1) usage "%")+          Normal -> logDebugN $ "System normal. CPU: " <> T.pack (showFFloat (Just 1) usage "%")           Warning -> logWarnN formattedReport           Critical -> logErrorN formattedReport           Catastrophic -> logErrorN $ "!!! " <> formattedReport <> " !!!"
himari.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.12 name: himari-version: 1.1.6.0+version: 1.1.6.1 synopsis: A standard library for Haskell as an alternative to rio description:   A standard library for Haskell inspired by rio.@@ -167,7 +167,7 @@   build-depends:     QuickCheck >=2.15.0.1 && <2.19,     himari,-    sydtest >=0.18.0.0 && <0.24,+    sydtest >=0.18.0.0 && <0.28,    build-tool-depends:     hlint:hlint >=3.10 && <4