optparse-generic 1.2.1 → 1.2.2
raw patch · 2 files changed
+10/−4 lines, 2 filesdep +Onlydep ~time
Dependencies added: Only
Dependency ranges changed: time
Files
- optparse-generic.cabal +3/−2
- src/Options/Generic.hs +7/−2
optparse-generic.cabal view
@@ -1,5 +1,5 @@ Name: optparse-generic-Version: 1.2.1+Version: 1.2.2 Cabal-Version: >=1.8.0.2 Build-Type: Simple License: BSD3@@ -27,8 +27,9 @@ system-filepath >= 0.3.1 && < 0.5 , text < 1.3 , transformers >= 0.2.0.0 && < 0.6 ,+ Only < 0.2 , optparse-applicative >= 0.12.0 && < 0.15,- time >= 1.5 && < 1.7 ,+ time >= 1.5 && < 1.9 , void < 0.8 , bytestring < 0.11, semigroups >= 0.5.0 && < 0.19
src/Options/Generic.hs view
@@ -305,6 +305,7 @@ import Data.List.NonEmpty (NonEmpty((:|))) import Data.Proxy import Data.Text (Text)+import Data.Tuple.Only (Only(..)) import Data.Typeable (Typeable) import Data.Void (Void) import Data.Foldable (foldMap)@@ -585,7 +586,7 @@ {-| A 1-tuple, used solely to translate `ParseFields` instances into `ParseRecord` instances -}-newtype Only a = Only a deriving (Generic, Show)+newtype Only_ a = Only_ a deriving (Generic, Show) {-| This is a convenience function that you can use if you want to create a `ParseRecord` instance that just defers to the `ParseFields` instance for@@ -614,7 +615,11 @@ default parseRecord :: (Generic a, GenericParseRecord (Rep a)) => Parser a parseRecord = fmap GHC.Generics.to (genericParseRecord defaultModifiers) -instance ParseFields a => ParseRecord (Only a)+instance ParseFields a => ParseRecord (Only_ a)+instance ParseFields a => ParseRecord (Only a) where+ parseRecord = fmap adapt parseRecord+ where+ adapt (Only_ x) = Only x instance ParseRecord Char where parseRecord = fmap getOnly parseRecord