Skip to content

Commit

Permalink
Add Eq to the "helper wrappers" (<?>), (<!>), (<#>) (#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
googleson78 committed Aug 5, 2023
1 parent 9a0f1be commit 97a1826
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Options/Generic.hs
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ instance ParseField a => ParseFields (NonEmpty a) where
> , bar :: Double <?> "Documentation for the bar flag"
> } deriving (Generic, Show)
-}
newtype (<?>) field (help :: Symbol) = Helpful { unHelpful :: field } deriving (Generic, Show, Data)
newtype (<?>) field (help :: Symbol) = Helpful { unHelpful :: field } deriving (Generic, Show, Data, Eq)

instance (ParseField a, KnownSymbol h) => ParseField (a <?> h) where
parseField _ m c d = Helpful <$>
Expand All @@ -732,7 +732,7 @@ instance (ParseFields a, KnownSymbol h) => ParseRecord (a <?> h)
> , bar :: Double <!> "0.5"
> } deriving (Generic, Show)
-}
newtype (<!>) field (value :: Symbol) = DefValue { unDefValue :: field } deriving (Generic, Show, Data)
newtype (<!>) field (value :: Symbol) = DefValue { unDefValue :: field } deriving (Generic, Show, Data, Eq)

instance (ParseField a, KnownSymbol d) => ParseField (a <!> d) where
parseField h m c _ = DefValue <$> parseField h m c (Just (symbolVal (Proxy :: Proxy d)))
Expand All @@ -752,7 +752,7 @@ instance (ParseFields a, KnownSymbol h) => ParseRecord (a <!> h)
> , bar :: Double <#> "b"
> } deriving (Generic, Show)
-}
newtype (<#>) field (value :: Symbol) = ShortName { unShortName :: field } deriving (Generic, Show, Data)
newtype (<#>) field (value :: Symbol) = ShortName { unShortName :: field } deriving (Generic, Show, Data, Eq)

instance (ParseField a, KnownSymbol c) => ParseField (a <#> c) where
parseField h m _ d = ShortName <$> parseField h m (listToMaybe (symbolVal (Proxy :: Proxy c))) d
Expand Down

0 comments on commit 97a1826

Please sign in to comment.