packages feed

autodocodec-nix 0.2.0.0 → 0.3.0.0

raw patch · 3 files changed

+22/−8 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Autodocodec.Nix: [optionExample] :: Option -> !Maybe Value
+ Autodocodec.Nix.Options: [optionExample] :: Option -> !Maybe Value
- Autodocodec.Nix: Option :: !Maybe OptionType -> !Maybe Text -> !Maybe Value -> ![Maybe Value] -> !OptionRequirement -> !Maybe Value -> Option
+ Autodocodec.Nix: Option :: !Maybe OptionType -> !Maybe Text -> !Maybe Value -> ![Maybe Value] -> !OptionRequirement -> !Maybe Value -> !Maybe Value -> Option
- Autodocodec.Nix.Options: Option :: !Maybe OptionType -> !Maybe Text -> !Maybe Value -> ![Maybe Value] -> !OptionRequirement -> !Maybe Value -> Option
+ Autodocodec.Nix.Options: Option :: !Maybe OptionType -> !Maybe Text -> !Maybe Value -> ![Maybe Value] -> !OptionRequirement -> !Maybe Value -> !Maybe Value -> Option

Files

CHANGELOG.md view
@@ -1,5 +1,11 @@ # Changelog +## [0.3.0.0] - 2026-11-16++### Added++* `optionExample` in `Option`, rendered as the `example` of the option.+ ## [0.2.0.0] - 2026-11-14  ### Added
autodocodec-nix.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack  name:           autodocodec-nix-version:        0.2.0.0+version:        0.3.0.0 synopsis:       Autodocodec interpreters for nix homepage:       https://github.com/NorfairKing/autodocodec#readme bug-reports:    https://github.com/NorfairKing/autodocodec/issues
src/Autodocodec/Nix/Options.hs view
@@ -109,7 +109,8 @@             optionDefault = Nothing,             optionAlternativeDefaults = [],             optionRequirement = requirement,-            optionDocumentedDefault = Nothing+            optionDocumentedDefault = Nothing,+            optionExample = Nothing           }       requiredByEither :: OptionRequirement -> OptionRequirement -> OptionRequirement       requiredByEither r1 r2 = case r1 of@@ -129,7 +130,8 @@                       optionDefault = Nothing,                       optionAlternativeDefaults = [],                       optionRequirement = OptionRequired,-                      optionDocumentedDefault = Nothing+                      optionDocumentedDefault = Nothing,+                      optionExample = Nothing                     }                 )                 $ case map (go . snd) $ M.elems byDiscriminator of@@ -146,7 +148,8 @@                 optionDefault = Just $ toJSONVia c defaultValue,                 optionAlternativeDefaults = [],                 optionRequirement = OptionOptional,-                optionDocumentedDefault = Nothing+                optionDocumentedDefault = Nothing,+                optionExample = Nothing               }         OptionalKeyWithOmittedDefaultCodec key c defaultValue mDesc ->           M.singleton@@ -157,7 +160,8 @@                 optionDefault = Just $ toJSONVia c defaultValue,                 optionAlternativeDefaults = [],                 optionRequirement = OptionOptional,-                optionDocumentedDefault = Nothing+                optionDocumentedDefault = Nothing,+                optionExample = Nothing               }         PureCodec _ -> M.empty         ApCodec c1 c2 ->@@ -304,7 +308,9 @@     -- | The default that whatever reads the value applies when the option is     -- left out, for an option without a default in Nix.     -- It is only documented, so that the value still leaves the option out.-    optionDocumentedDefault :: !(Maybe JSON.Value)+    optionDocumentedDefault :: !(Maybe JSON.Value),+    -- | A value to show in the documentation of the option.+    optionExample :: !(Maybe JSON.Value)   }   deriving (Show, Eq, Ord) @@ -322,7 +328,8 @@       optionDefault = Nothing,       optionAlternativeDefaults = [],       optionRequirement = OptionOptional,-      optionDocumentedDefault = Nothing+      optionDocumentedDefault = Nothing,+      optionExample = Nothing     }  simplifyOption :: Option -> Option@@ -509,7 +516,8 @@                         )                       | not isUnspecifiedSubmodule                       ]-                    Just d -> [("default", toNixExpressionViaCodec d)]+                    Just d -> [("default", toNixExpressionViaCodec d)],+                  [("example", toNixExpressionViaCodec e) | e <- maybeToList optionExample]                 ]         )