Marshal any value that implements ParseRecord from the command line
If you need to modify the top-level ParserInfo or ParserPrefs
use the getRecordWith function.
:: a typeCtrl KGHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05
Moduleoptparse-generic-1.5.2Haskell2010
This library auto-generates command-line parsers for data types using Haskell's built-in support for generic programming. The best way to understand how this library works is to walk through a few examples.
For example, suppose that you want to parse a record with named fields like this:
-- Example.hs
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
import Options.Generic
data Example = Example { foo :: Int, bar :: Double }
deriving (Generic, Show)
instance ParseRecord Example
main = do
x <- getRecord "Test program"
print (x :: Example)Named fields translate to flags which you can provide in any order:
$ stack build optparse-generic
$ stack runghc Example.hs -- --bar 2.5 --foo 1
Example {foo = 1, bar = 2.5}This also auto-generates --help output:
$ stack runghc Example.hs -- --help
Test program
Usage: Example.hs --foo INT --bar DOUBLE
Available options:
-h,--help Show this help textYou can also add help descriptions to each field, like this:
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeOperators #-}
import Options.Generic
data Example = Example
{ foo :: Int <?> "Documentation for the foo flag"
, bar :: Double <?> "Documentation for the bar flag"
} deriving (Generic, Show)
instance ParseRecord Example
main = do
x <- getRecord "Test program"
print (x :: Example)... which produces the following --help output:
$ stack runghc Example.hs -- --help
Test program
Usage: Example.hs --foo INT --bar DOUBLE
Available options:
-h,--help Show this help text
--foo INT Documentation for the foo flag
--bar DOUBLE Documentation for the bar flagHowever, any fields you document will be wrapped in the Helpful constructor:
$ stack runghc Example.hs -- --foo 1 --bar 2.5
Example {foo = Helpful {unHelpful = 1}, bar = Helpful {unHelpful = 2.5}}To avoid this, while still being able to document your fields, you may
generalize the definition of your record with a parameter w, and use
unwrapRecord.
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleInstances #-} -- One more extension.
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE StandaloneDeriving #-} -- To derive Show
{-# LANGUAGE TypeOperators #-}
import Options.Generic
data Example w = Example
{ foo :: w ::: Int <?> "Documentation for the foo flag"
, bar :: w ::: Double <?> "Documentation for the bar flag"
} deriving (Generic)
instance ParseRecord (Example Wrapped)
deriving instance Show (Example Unwrapped)
main = do
x <- unwrapRecord "Test program"
print (x :: Example Unwrapped)Example Unwrapped is equivalent to a record type with simple fields:
$ stack runghc Example.hs -- --foo 1 --bar 2.5
Example {foo = 1, bar = 2.5}You can also add default values to each Readable field, like this:
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeOperators #-}
import Options.Generic
data Example = Example
{ foo :: Int <!> "1"
, bar :: String <!> "hello"
} deriving (Generic, Show)
instance ParseRecord Example
main = do
x <- getRecord "Test program"
print (x :: Example)Default values will work alongside help descriptions and unwrapping.
For the following examples I encourage you to test what --help output they
generate.
This library will also do the right thing if the fields have no labels:
data Example = Example Int Double deriving (Generic, Show)Fields without labels translate into positional command-line arguments:
$ stack runghc Example.hs -- 1 2.5
Example 1 2.5Certain types of fields are given special treatment, such as in this example:
data Example = Example
{ switch :: Bool
, list :: [Int]
, optional :: Maybe Int
, first :: First Int
, last :: Last Int
, sum :: Sum Int
, product :: Product Int
} deriving (Generic, Show)This gives the following behavior:
$ stack runghc Example.hs --
--switch
--optional 1
--list 1 --list 2
--first 1 --first 2
--last 1 --last 2
--sum 1 --sum 2
--product 1 --product 2
Example {switch = True, list = [1,2], optional = Just 1, first = First
{getFirst = Just 1}, last = Last {getLast = Just 2}, sum = Sum {getSum =
3}, product = Product {getProduct = 2}}
$ stack runghc Example.hs
Example {switch = False, list = [], optional = Nothing, first = First
{getFirst = Nothing}, second = Last {getLast = Nothing}, sum = Sum {getSum
= 0}, product = Product {getProduct = 1}}If a datatype has multiple constructors:
data Example
= Create { name :: Text, duration :: Maybe Int }
| Kill { name :: Text }
deriving (Generic, Show)... then they will translate into subcommands named after each constructor:
$ stack runghc Example.hs -- create --name foo --duration=60
Create {name = "foo", duration = Just 60}
$ stack runghc Example.hs -- kill --name foo
Kill {name = "foo"}This library also provides out-of-the-box support for many existing types, like tuples and Either.
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
import Options.Generic
main = do
x <- getRecord "Test program"
print (x :: Either Double Int)$ stack runghc Example.hs -- left 1.0
Left 1.0
$ stack runghc Example.hs -- right 2
Right 2main = do
x <- getRecord "Test program"
print (x :: (Double, Int))$ stack runghc Example.hs -- 1.0 2
(1.0,2)... and you can also just parse a single value:
main = do
x <- getRecord "Test program"
print (x :: Int)$ stack runghc Example.hs -- 2
2However, there are some types that this library cannot generate sensible command-line parsers for, such as:
recursive types:
data Example = Example { foo :: Example }records whose fields are other records
data Outer = Outer { foo :: Inner } deriving (Show, Generic)
data Inner = Inner { bar :: Int } deriving (Show, Generic)record fields with nested Maybes or nested lists
data Example = Example { foo :: Maybe (Maybe Int) }
data Example = Example { foo :: [[Int]] }If you try to auto-generate a parser for these types you will get an error at compile time that will look something like this:
No instance for (ParseFields TheTypeOfYourField)
arising from a use of ‘Options.Generic.$gdmparseRecord’
In the expression: Options.Generic.$gdmparseRecord
In an equation for ‘parseRecord’:
parseRecord = Options.Generic.$gdmparseRecord
In the instance declaration for ‘ParseRecord TheTypeOfYourRecord’You can customize the library's default behavior using the parseRecordWithModifiers utility, like this:
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
import Options.Generic
data Example = Example { foo :: Int, bar :: Double }
deriving (Generic, Show)
modifiers :: Modifiers
modifiers = defaultModifiers
{ shortNameModifier = firstLetter
}
instance ParseRecord Example where
parseRecord = parseRecordWithModifiers modifiers
main = do
x <- getRecord "Test program"
print (x :: Example)Marshal any value that implements ParseRecord from the command line
If you need to modify the top-level ParserInfo or ParserPrefs
use the getRecordWith function.
getRecordWith :: (MonadIO io, ParseRecord a)=> InfoMod aParserInfo modifiers
-> PrefsModParserPrefs modifiers
-> io aMarshal any value that implements ParseRecord from the command line
This is the lower-level sibling of 'getRecord and lets you modify
the ParserInfo and ParserPrefs records.
getWithHelpWith :: (MonadIO io, ParseRecord a)=> TextProgram description
-> PrefsModParserPrefs modifiers
-> io (a, io ())(options, io action to print help message)
Marshal any value that implements ParseRecord from the commmand line alongside an io action that prints the help message.
getWithHelp :: (MonadIO io, ParseRecord a)=> TextProgram description
-> io (a, io ())(options, io action to print help message)
Marshal any value that implements ParseRecord from the commmand line alongside an io action that prints the help message.
Pure version of getRecord
If you need to modify the parser's ParserInfo or ParserPrefs, use
getRecordPureWith.
:set -XOverloadedStringsgetRecordPure ["1"] :: Maybe IntJust 1getRecordPure ["1", "2"] :: Maybe [Int]Just [1,2]getRecordPure ["Foo"] :: Maybe IntNothing
getRecordPureWith :: ParseRecord a=> [Text]Command-line arguments
-> InfoMod aParserInfo modifiers
-> PrefsModParserPrefs modifiers
-> Maybe aPure version of getRecordWith
Like getRecordWith, this is a sibling of 'getRecordPure and
exposes the monoidal modifier structures for ParserInfo and
ParserPrefs to you.
:set -XOverloadedStringsgetRecordPureWith ["1"] mempty mempty :: Maybe IntJust 1getRecordPureWith ["1", "2"] mempty mempty :: Maybe [Int]Just [1,2]getRecordPureWith ["Foo"] mempty mempty :: Maybe IntNothing
Marshal any value that implements ParseRecord from the command line and unwrap its fields
unwrapWithHelp :: (MonadIO io, ParseRecord (f Wrapped), Unwrappable f)=> TextProgram description
-> io (f Unwrapped, io ())(options, io action to print help message)
Marshal any value that implements ParseRecord from the command line and unwrap its fields alongside an io action to print the help message
unwrapRecordPure :: (ParseRecord (f Wrapped), Unwrappable f)=> [Text]Command-line arguments
-> Maybe (f Unwrapped)Pure version of unwrapRecord
Unwrap the fields of a constructor
A class for types that can be parsed from the command line
This class has a default implementation for any type that implements
Generic and you can derive Generic for many types by enabling the
DeriveGeneric language extension
You can also use getOnly to create a ParseRecord instance from a ParseFields instance:
instance ParseRecord MyType where
parseRecord = fmap getOnly parseRecordparseRecord :: Parser aParseRecord ByteStringDefined in optparse-generic-1.5.2 · Options.GenericParseRecord ByteStringDefined in optparse-generic-1.5.2 · Options.GenericParseRecord IntegerDefined in optparse-generic-1.5.2 · Options.GenericParseRecord NaturalDefined in optparse-generic-1.5.2 · Options.GenericParseRecord VoidDefined in optparse-generic-1.5.2 · Options.GenericParseRecord AllDefined in optparse-generic-1.5.2 · Options.GenericParseRecord AnyDefined in optparse-generic-1.5.2 · Options.GenericParseRecord Int16Defined in optparse-generic-1.5.2 · Options.GenericParseRecord Int32Defined in optparse-generic-1.5.2 · Options.GenericParseRecord Int64Defined in optparse-generic-1.5.2 · Options.GenericParseRecord Int8Defined in optparse-generic-1.5.2 · Options.GenericParseRecord Word16Defined in optparse-generic-1.5.2 · Options.GenericParseRecord Word32Defined in optparse-generic-1.5.2 · Options.GenericParseRecord Word64Defined in optparse-generic-1.5.2 · Options.GenericParseRecord Word8Defined in optparse-generic-1.5.2 · Options.GenericParseRecord BoolDefined in optparse-generic-1.5.2 · Options.GenericParseRecord CharDefined in optparse-generic-1.5.2 · Options.GenericParseRecord DoubleDefined in optparse-generic-1.5.2 · Options.GenericParseRecord FloatDefined in optparse-generic-1.5.2 · Options.GenericParseRecord IntDefined in optparse-generic-1.5.2 · Options.GenericParseRecord OrderingDefined in optparse-generic-1.5.2 · Options.GenericParseRecord OsStringDefined in optparse-generic-1.5.2 · Options.GenericParseRecord TextDefined in optparse-generic-1.5.2 · Options.GenericParseRecord TextDefined in optparse-generic-1.5.2 · Options.GenericParseRecord CalendarDiffDaysDefined in optparse-generic-1.5.2 · Options.GenericParseRecord DayDefined in optparse-generic-1.5.2 · Options.GenericParseRecord UTCTimeDefined in optparse-generic-1.5.2 · Options.GenericParseRecord CalendarDiffTimeDefined in optparse-generic-1.5.2 · Options.GenericParseRecord LocalTimeDefined in optparse-generic-1.5.2 · Options.GenericParseRecord TimeOfDayDefined in optparse-generic-1.5.2 · Options.GenericParseRecord TimeZoneDefined in optparse-generic-1.5.2 · Options.GenericParseRecord ZonedTimeDefined in optparse-generic-1.5.2 · Options.GenericParseRecord ()Defined in optparse-generic-1.5.2 · Options.GenericParseField a => ParseRecord (NonEmpty a)Defined in optparse-generic-1.5.2 · Options.GenericParseField a => ParseRecord (First a)Defined in optparse-generic-1.5.2 · Options.GenericParseField a => ParseRecord (Last a)Defined in optparse-generic-1.5.2 · Options.GenericParseField a => ParseRecord (Maybe a)Defined in optparse-generic-1.5.2 · Options.GenericParseField a => ParseRecord [a]Defined in optparse-generic-1.5.2 · Options.GenericParseFields a => ParseRecord (Only a)Defined in optparse-generic-1.5.2 · Options.GenericParseFields a => ParseRecord (Only_ a)Defined in optparse-generic-1.5.2 · Options.Generic(Num a, ParseField a) => ParseRecord (Product a)Defined in optparse-generic-1.5.2 · Options.Generic(Num a, ParseField a) => ParseRecord (Sum a)Defined in optparse-generic-1.5.2 · Options.Generic(ParseFields a, KnownSymbol h) => ParseRecord (a <!> h)Defined in optparse-generic-1.5.2 · Options.Generic(ParseFields a, KnownSymbol h) => ParseRecord (a <#> h)Defined in optparse-generic-1.5.2 · Options.Generic(ParseFields a, KnownSymbol h) => ParseRecord (a <?> h)Defined in optparse-generic-1.5.2 · Options.Generic(ParseFields a, ParseFields b) => ParseRecord (Either a b)Defined in optparse-generic-1.5.2 · Options.Generic(ParseFields a, ParseFields b) => ParseRecord (a, b)Defined in optparse-generic-1.5.2 · Options.Generic(ParseFields a, ParseFields b, ParseFields c) => ParseRecord (a, b, c)Defined in optparse-generic-1.5.2 · Options.Generic(ParseFields a, ParseFields b, ParseFields c, ParseFields d) => ParseRecord (a, b, c, d)Defined in optparse-generic-1.5.2 · Options.Generic(ParseFields a, ParseFields b, ParseFields c, ParseFields d, ParseFields e) => ParseRecord (a, b, c, d, e)Defined in optparse-generic-1.5.2 · Options.Generic(ParseFields a, ParseFields b, ParseFields c, ParseFields d, ParseFields e, ParseFields f) => ParseRecord (a, b, c, d, e, f)Defined in optparse-generic-1.5.2 · Options.Generic(ParseFields a, ParseFields b, ParseFields c, ParseFields d, ParseFields e, ParseFields f, ParseFields g) => ParseRecord (a, b, c, d, e, f, g)Defined in optparse-generic-1.5.2 · Options.GenericA class for all types that can be parsed from zero or more arguments/options on the command line
parseFields has a default implementation for any type that implements ParseField
ParseFields ByteStringDefined in optparse-generic-1.5.2 · Options.GenericParseFields ByteStringDefined in optparse-generic-1.5.2 · Options.GenericParseFields IntegerDefined in optparse-generic-1.5.2 · Options.GenericParseFields NaturalDefined in optparse-generic-1.5.2 · Options.GenericParseFields VoidDefined in optparse-generic-1.5.2 · Options.GenericParseFields AllDefined in optparse-generic-1.5.2 · Options.GenericParseFields AnyDefined in optparse-generic-1.5.2 · Options.GenericParseFields Int16Defined in optparse-generic-1.5.2 · Options.GenericParseFields Int32Defined in optparse-generic-1.5.2 · Options.GenericParseFields Int64Defined in optparse-generic-1.5.2 · Options.GenericParseFields Int8Defined in optparse-generic-1.5.2 · Options.GenericParseFields Word16Defined in optparse-generic-1.5.2 · Options.GenericParseFields Word32Defined in optparse-generic-1.5.2 · Options.GenericParseFields Word64Defined in optparse-generic-1.5.2 · Options.GenericParseFields Word8Defined in optparse-generic-1.5.2 · Options.GenericParseFields BoolDefined in optparse-generic-1.5.2 · Options.GenericParseFields CharDefined in optparse-generic-1.5.2 · Options.GenericParseFields DoubleDefined in optparse-generic-1.5.2 · Options.GenericParseFields FloatDefined in optparse-generic-1.5.2 · Options.GenericParseFields IntDefined in optparse-generic-1.5.2 · Options.GenericParseFields OrderingDefined in optparse-generic-1.5.2 · Options.GenericParseFields OsStringDefined in optparse-generic-1.5.2 · Options.GenericParseFields TextDefined in optparse-generic-1.5.2 · Options.GenericParseFields TextDefined in optparse-generic-1.5.2 · Options.GenericParseFields CalendarDiffDaysDefined in optparse-generic-1.5.2 · Options.GenericParseFields DayDefined in optparse-generic-1.5.2 · Options.GenericParseFields UTCTimeDefined in optparse-generic-1.5.2 · Options.GenericParseFields CalendarDiffTimeDefined in optparse-generic-1.5.2 · Options.GenericParseFields LocalTimeDefined in optparse-generic-1.5.2 · Options.GenericParseFields TimeOfDayDefined in optparse-generic-1.5.2 · Options.GenericParseFields TimeZoneDefined in optparse-generic-1.5.2 · Options.GenericParseFields ZonedTimeDefined in optparse-generic-1.5.2 · Options.GenericParseFields ()Defined in optparse-generic-1.5.2 · Options.GenericParseField a => ParseFields (NonEmpty a)Defined in optparse-generic-1.5.2 · Options.GenericParseField a => ParseFields (First a)Defined in optparse-generic-1.5.2 · Options.GenericParseField a => ParseFields (Last a)Defined in optparse-generic-1.5.2 · Options.GenericParseField a => ParseFields (Maybe a)Defined in optparse-generic-1.5.2 · Options.GenericParseField a => ParseFields [a]Defined in optparse-generic-1.5.2 · Options.Generic(Num a, ParseField a) => ParseFields (Product a)Defined in optparse-generic-1.5.2 · Options.Generic(Num a, ParseField a) => ParseFields (Sum a)Defined in optparse-generic-1.5.2 · Options.Generic(ParseFields a, KnownSymbol c) => ParseFields (a <#> c)Defined in optparse-generic-1.5.2 · Options.Generic(ParseFields a, KnownSymbol d) => ParseFields (a <!> d)Defined in optparse-generic-1.5.2 · Options.Generic(ParseFields a, KnownSymbol h) => ParseFields (a <?> h)Defined in optparse-generic-1.5.2 · Options.GenericA class for all record fields that can be parsed from exactly one option or argument on the command line
parseField has a default implementation for any type that implements
Read and Typeable. You can derive Read for many types and you can
derive Typeable for any type if you enable the DeriveDataTypeable
language extension
parseField :: Maybe Text -> Maybe Text -> Maybe Char -> Maybe String -> Parser aparseListOfField :: Maybe Text -> Maybe Text -> Maybe Char -> Maybe String -> Parser [a]The only reason for this method is to provide a special case for handling Strings. All other instances should just fall back on the default implementation for parseListOfField
readField :: ReadM ametavar :: proxy a -> StringParseField ByteStringDefined in optparse-generic-1.5.2 · Options.GenericParseField ByteStringDefined in optparse-generic-1.5.2 · Options.GenericParseField IntegerDefined in optparse-generic-1.5.2 · Options.GenericParseField NaturalDefined in optparse-generic-1.5.2 · Options.GenericParseField StringDefined in optparse-generic-1.5.2 · Options.GenericParseField VoidDefined in optparse-generic-1.5.2 · Options.GenericParseField AllDefined in optparse-generic-1.5.2 · Options.GenericParseField AnyDefined in optparse-generic-1.5.2 · Options.GenericParseField Int16Defined in optparse-generic-1.5.2 · Options.GenericParseField Int32Defined in optparse-generic-1.5.2 · Options.GenericParseField Int64Defined in optparse-generic-1.5.2 · Options.GenericParseField Int8Defined in optparse-generic-1.5.2 · Options.GenericParseField Word16Defined in optparse-generic-1.5.2 · Options.GenericParseField Word32Defined in optparse-generic-1.5.2 · Options.GenericParseField Word64Defined in optparse-generic-1.5.2 · Options.GenericParseField Word8Defined in optparse-generic-1.5.2 · Options.GenericParseField BoolDefined in optparse-generic-1.5.2 · Options.GenericParseField CharDefined in optparse-generic-1.5.2 · Options.GenericParseField DoubleDefined in optparse-generic-1.5.2 · Options.GenericParseField FloatDefined in optparse-generic-1.5.2 · Options.GenericParseField IntDefined in optparse-generic-1.5.2 · Options.GenericParseField OrderingDefined in optparse-generic-1.5.2 · Options.GenericParseField OsStringDefined in optparse-generic-1.5.2 · Options.GenericParseField TextDefined in optparse-generic-1.5.2 · Options.GenericParseField TextDefined in optparse-generic-1.5.2 · Options.GenericParseField CalendarDiffDaysDefined in optparse-generic-1.5.2 · Options.GenericParseField DayDefined in optparse-generic-1.5.2 · Options.GenericParseField UTCTimeDefined in optparse-generic-1.5.2 · Options.GenericParseField CalendarDiffTimeDefined in optparse-generic-1.5.2 · Options.GenericParseField LocalTimeDefined in optparse-generic-1.5.2 · Options.GenericParseField TimeOfDayDefined in optparse-generic-1.5.2 · Options.GenericParseField TimeZoneDefined in optparse-generic-1.5.2 · Options.GenericParseField ZonedTimeDefined in optparse-generic-1.5.2 · Options.GenericParseField ()Defined in optparse-generic-1.5.2 · Options.Generic(ParseField a, KnownSymbol c) => ParseField (a <#> c)Defined in optparse-generic-1.5.2 · Options.Generic(ParseField a, KnownSymbol d) => ParseField (a <!> d)Defined in optparse-generic-1.5.2 · Options.Generic(ParseField a, KnownSymbol h) => ParseField (a <?> h)Defined in optparse-generic-1.5.2 · Options.GenericThe 1-tuple type or single-value "collection".
This type is structurally equivalent to the Identity type, but its intent is more about serving as the anonymous 1-tuple type missing from Haskell for attaching typeclass instances.
Parameter usage example:
encodeSomething (Only (42::Int))Result usage example:
xs <- decodeSomething
forM_ xs $ \(Only id) -> {- ... -}Functor OnlyDefined in Only-0.1 · Data.Tuple.OnlyEq a => Eq (Only a)Defined in Only-0.1 · Data.Tuple.OnlyData a => Data (Only a)Defined in Only-0.1 · Data.Tuple.OnlyOrd a => Ord (Only a)Defined in Only-0.1 · Data.Tuple.OnlyRead a => Read (Only a)Defined in Only-0.1 · Data.Tuple.OnlyShow a => Show (Only a)Defined in Only-0.1 · Data.Tuple.OnlyGeneric (Only a)Defined in Only-0.1 · Data.Tuple.OnlyNFData a => NFData (Only a)Defined in Only-0.1 · Data.Tuple.OnlyParseFields a => ParseRecord (Only a)Defined in optparse-generic-1.5.2 · Options.Generictype Rep (Only a) = D1 ('MetaData "Only"
"Data.Tuple.Only"
"Only-0.1-8BKwq0wmUnbJYtB6F6W6xk"
'True) (C1 ('MetaCons "Only"
'PrefixI 'True) (S1 ('MetaSel ('Just "fromOnly"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))Defined in Only-0.1 · Data.Tuple.OnlyThis is a convenience function that you can use if you want to create a ParseRecord instance that just defers to the ParseFields instance for the same type:
instance ParseRecord MyType where
parseRecord = fmap getOnly parseRecordOptions for customizing derived ParseRecord implementations for Generic types
You can either create the Modifiers record directly:
modifiers :: Modifiers
modifiers = Modifiers
{ fieldNameModifier = ...
, constructorNameModifier = ...
, shortNameModifier = ...
}... or you can tweak the defaultModifiers:
modifiers :: Modifiers
modifiers = defaultModifiers { fieldNameModifier = ... }... or you can use/tweak a predefined Modifier, like lispCaseModifiers
The parseRecordWithModifiers function uses this Modifiers record when generating a Generic implementation of ParseRecord
ModifiersfieldNameModifier :: String -> StringTransform the name of derived fields (Default: id)
constructorNameModifier :: String -> StringTransform the name of derived constructors (Default: map toLower)
shortNameModifier :: String -> Maybe CharDerives an optional short name from the field name (Default: \_ -> Nothing)
Use parseRecordWithModifiers when you want to tweak the behavior of a derived ParseRecord implementation, like this:
myModifiers :: Modifiers
myModifiers = defaultModifiers { constructorNameModifier = id }
instance ParseRecord MyType where
parseRecord = parseRecordWithModifiers myModifiersThis will still require that you derive Generic for your type to automate most of the implementation, but the Modifiers that you pass will change how the implementation generates the command line interface
These are the default modifiers used if you derive a Generic implementation. You can customize this and pass the result to parseRecordWithModifiers if you would like to modify the derived implementation:
myModifiers :: Modifiers
myModifiers = defaultModifiers { constructorNameModifier = id }
instance ParseRecord MyType where
parseRecord = parseRecordWithModifiers myModifiersConvert field and constructor names from CamelCase to lisp-case.
Leading underscores are dropped, allowing one to use option names which are Haskell keywords or otherwise conflicting identifiers.
BuildCommand -> build-command
someFlag -> --some-flag
_type -> --type
_splitAt -> --split-atUse this for the shortNameModifier field of the Modifiers record if you want to use the first letter of each option as the short name
genericParseRecord :: Modifiers -> Parser (f p)GenericParseRecord U1Defined in optparse-generic-1.5.2 · Options.GenericGenericParseRecord V1Defined in optparse-generic-1.5.2 · Options.Generic(Constructor c, GenericParseRecord (f :+: g), GenericParseRecord h) => GenericParseRecord ((f :+: g) :+: M1 C c h)Defined in optparse-generic-1.5.2 · Options.Generic(Constructor c, GenericParseRecord f, GenericParseRecord (g :+: h)) => GenericParseRecord (M1 C c f :+: (g :+: h))Defined in optparse-generic-1.5.2 · Options.Generic(Constructor c1, Constructor c2, GenericParseRecord f1, GenericParseRecord f2) => GenericParseRecord (M1 C c1 f1 :+: M1 C c2 f2)Defined in optparse-generic-1.5.2 · Options.Generic(GenericParseRecord (f :+: g), GenericParseRecord (h :+: i)) => GenericParseRecord ((f :+: g) :+: (h :+: i))Defined in optparse-generic-1.5.2 · Options.Generic(GenericParseRecord f, GenericParseRecord g) => GenericParseRecord (f :*: g)Defined in optparse-generic-1.5.2 · Options.GenericGenericParseRecord f => GenericParseRecord (M1 C c f)Defined in optparse-generic-1.5.2 · Options.GenericGenericParseRecord f => GenericParseRecord (M1 D c f)Defined in optparse-generic-1.5.2 · Options.Generic(Selector s, ParseFields a) => GenericParseRecord (M1 S s (K1 i a))Defined in optparse-generic-1.5.2 · Options.GenericUse this to annotate a field with a type-level string (i.e. a Symbol) representing the help description for that field:
data Example = Example
{ foo :: Int <?> "Documentation for the foo flag"
, bar :: Double <?> "Documentation for the bar flag"
} deriving (Generic, Show)Eq field => Eq (field <?> help)Defined in optparse-generic-1.5.2 · Options.Generic(KnownSymbol help, Data field) => Data (field <?> help)Defined in optparse-generic-1.5.2 · Options.GenericShow field => Show (field <?> help)Defined in optparse-generic-1.5.2 · Options.GenericGeneric (field <?> help)Defined in optparse-generic-1.5.2 · Options.Generic(ParseField a, KnownSymbol h) => ParseField (a <?> h)Defined in optparse-generic-1.5.2 · Options.Generic(ParseFields a, KnownSymbol h) => ParseFields (a <?> h)Defined in optparse-generic-1.5.2 · Options.Generic(ParseFields a, KnownSymbol h) => ParseRecord (a <?> h)Defined in optparse-generic-1.5.2 · Options.GenericGenericUnwrappable (K1 i field) (K1 i c) => GenericUnwrappable (K1 i (field <?> helper)) (K1 i c)Defined in optparse-generic-1.5.2 · Options.Generictype Rep (field <?> help) = D1 ('MetaData "<?>"
"Options.Generic"
"optparse-generic-1.5.2-DTzPLCXKjNY8PVsJHjfVPp"
'True) (C1 ('MetaCons "Helpful"
'PrefixI 'True) (S1 ('MetaSel ('Just "unHelpful"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 field)))Defined in optparse-generic-1.5.2 · Options.GenericUse this to annotate a field with a type-level string (i.e. a Symbol) representing the default value for that field:
data Example = Example
{ foo :: Int <!> "1"
, bar :: Double <!> "0.5"
} deriving (Generic, Show)DefValueunDefValue :: fieldEq field => Eq (field <!> value)Defined in optparse-generic-1.5.2 · Options.Generic(KnownSymbol value, Data field) => Data (field <!> value)Defined in optparse-generic-1.5.2 · Options.GenericShow field => Show (field <!> value)Defined in optparse-generic-1.5.2 · Options.GenericGeneric (field <!> value)Defined in optparse-generic-1.5.2 · Options.Generic(ParseField a, KnownSymbol d) => ParseField (a <!> d)Defined in optparse-generic-1.5.2 · Options.Generic(ParseFields a, KnownSymbol d) => ParseFields (a <!> d)Defined in optparse-generic-1.5.2 · Options.Generic(ParseFields a, KnownSymbol h) => ParseRecord (a <!> h)Defined in optparse-generic-1.5.2 · Options.GenericGenericUnwrappable (K1 i field) (K1 i c) => GenericUnwrappable (K1 i (field <!> defVal)) (K1 i c)Defined in optparse-generic-1.5.2 · Options.Generictype Rep (field <!> value) = D1 ('MetaData "<!>"
"Options.Generic"
"optparse-generic-1.5.2-DTzPLCXKjNY8PVsJHjfVPp"
'True) (C1 ('MetaCons "DefValue"
'PrefixI 'True) (S1 ('MetaSel ('Just "unDefValue"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 field)))Defined in optparse-generic-1.5.2 · Options.GenericUse this to annotate a field with a type-level char (i.e. a Symbol) representing the short name of the field (only the first character of the symbol is used):
data Example = Example
{ foo :: Int <#> "f"
, bar :: Double <#> "b"
} deriving (Generic, Show)ShortNameunShortName :: fieldEq field => Eq (field <#> value)Defined in optparse-generic-1.5.2 · Options.Generic(KnownSymbol value, Data field) => Data (field <#> value)Defined in optparse-generic-1.5.2 · Options.GenericShow field => Show (field <#> value)Defined in optparse-generic-1.5.2 · Options.GenericGeneric (field <#> value)Defined in optparse-generic-1.5.2 · Options.Generic(ParseField a, KnownSymbol c) => ParseField (a <#> c)Defined in optparse-generic-1.5.2 · Options.Generic(ParseFields a, KnownSymbol c) => ParseFields (a <#> c)Defined in optparse-generic-1.5.2 · Options.Generic(ParseFields a, KnownSymbol h) => ParseRecord (a <#> h)Defined in optparse-generic-1.5.2 · Options.GenericGenericUnwrappable (K1 i field) (K1 i c) => GenericUnwrappable (K1 i (field <#> defVal)) (K1 i c)Defined in optparse-generic-1.5.2 · Options.Generictype Rep (field <#> value) = D1 ('MetaData "<#>"
"Options.Generic"
"optparse-generic-1.5.2-DTzPLCXKjNY8PVsJHjfVPp"
'True) (C1 ('MetaCons "ShortName"
'PrefixI 'True) (S1 ('MetaSel ('Just "unShortName"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 field)))Defined in optparse-generic-1.5.2 · Options.GenericA type family to extract fields wrapped using (<?>)
Flag to keep fields wrapped
Flag to unwrap fields annotated using (<?>)
type Unwrappable (f :: Type -> Type) = (Generic (f Wrapped), Generic (f Unwrapped), GenericUnwrappable (Rep (f Wrapped)) (Rep (f Unwrapped)))Constraint for types whose fields can be unwrapped
Generic ShortByteStringDefined in bytestring-0.12.2.0 · Data.ByteString.Short.InternalGeneric ForeignSrcLangDefined in ghc-boot-th-9.10.3 · GHC.ForeignSrcLang.TypeGeneric ExtensionDefined in ghc-boot-th-9.10.3 · GHC.LanguageExtensions.TypeGeneric VoidDefined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric ByteOrderDefined in ghc-internal-9.1003.0 · GHC.Internal.ByteOrderGeneric ClosureTypeDefined in ghc-internal-9.1003.0 · GHC.Internal.ClosureTypesGeneric AllDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalGeneric AnyDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalGeneric VersionDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.VersionGeneric FingerprintDefined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric AssociativityDefined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric DecidedStrictnessDefined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric FixityDefined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric SourceStrictnessDefined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric SourceUnpackednessDefined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric ExitCodeDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.ExceptionGeneric CCFlagsDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.FlagsGeneric ConcFlagsDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.FlagsGeneric DebugFlagsDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.FlagsGeneric DoCostCentresDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.FlagsGeneric DoHeapProfileDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.FlagsGeneric DoTraceDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.FlagsGeneric GCFlagsDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.FlagsGeneric GiveGCStatsDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.FlagsGeneric HpcFlagsDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.FlagsGeneric MiscFlagsDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.FlagsGeneric ParFlagsDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.FlagsGeneric ProfFlagsDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.FlagsGeneric RTSFlagsDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.FlagsGeneric TickyFlagsDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.FlagsGeneric TraceFlagsDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.FlagsGeneric SrcLocDefined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric GCDetailsDefined in ghc-internal-9.1003.0 · GHC.Internal.StatsGeneric RTSStatsDefined in ghc-internal-9.1003.0 · GHC.Internal.StatsGeneric GeneralCategoryDefined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric BoolDefined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric OrderingDefined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric OsCharDefined in os-string-2.0.7 · System.OsString.Internal.TypesGeneric OsStringDefined in os-string-2.0.7 · System.OsString.Internal.TypesGeneric PosixCharDefined in os-string-2.0.7 · System.OsString.Internal.TypesGeneric PosixStringDefined in os-string-2.0.7 · System.OsString.Internal.TypesGeneric WindowsCharDefined in os-string-2.0.7 · System.OsString.Internal.TypesGeneric WindowsStringDefined in os-string-2.0.7 · System.OsString.Internal.TypesGeneric ModeDefined in pretty-1.1.3.6 · Text.PrettyPrint.Annotated.HughesPJGeneric StyleDefined in pretty-1.1.3.6 · Text.PrettyPrint.Annotated.HughesPJGeneric TextDetailsDefined in pretty-1.1.3.6 · Text.PrettyPrint.Annotated.HughesPJGeneric DocDefined in pretty-1.1.3.6 · Text.PrettyPrint.HughesPJGeneric AnnLookupDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric AnnTargetDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric BangDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric BndrVisDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric BodyDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric BytesDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric CallconvDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric ClauseDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric ConDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric DecDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric DecidedStrictnessDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric DerivClauseDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric DerivStrategyDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric DocLocDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric ExpDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric FamilyResultSigDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric FixityDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric FixityDirectionDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric ForeignDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric FunDepDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric GuardDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric InfoDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric InjectivityAnnDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric InlineDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric LitDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric LocDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric MatchDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric ModNameDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric ModuleDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric ModuleInfoDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric NameDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric NameFlavourDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric NameSpaceDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric NamespaceSpecifierDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric OccNameDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric OverlapDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric PatDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric PatSynArgsDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric PatSynDirDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric PhasesDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric PkgNameDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric PragmaDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric RangeDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric RoleDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric RuleBndrDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric RuleMatchDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric SafetyDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric SourceStrictnessDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric SourceUnpackednessDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric SpecificityDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric StmtDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric TyLitDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric TySynEqnDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric TypeDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric TypeFamilyHeadDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric ()Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (Only a)Defined in Only-0.1 · Data.Tuple.OnlyGeneric (Complex a)Defined in base-4.20.2.0 · Data.ComplexGeneric (First a)Defined in base-4.20.2.0 · Data.SemigroupGeneric (Last a)Defined in base-4.20.2.0 · Data.SemigroupGeneric (Max a)Defined in base-4.20.2.0 · Data.SemigroupGeneric (Min a)Defined in base-4.20.2.0 · Data.SemigroupGeneric (WrappedMonoid m)Defined in base-4.20.2.0 · Data.SemigroupGeneric (SCC vertex)Defined in containers-0.7 · Data.GraphGeneric (Digit a)Defined in containers-0.7 · Data.Sequence.InternalGeneric (Elem a)Defined in containers-0.7 · Data.Sequence.InternalGeneric (FingerTree a)Defined in containers-0.7 · Data.Sequence.InternalGeneric (Node a)Defined in containers-0.7 · Data.Sequence.InternalGeneric (ViewL a)Defined in containers-0.7 · Data.Sequence.InternalGeneric (ViewR a)Defined in containers-0.7 · Data.Sequence.InternalGeneric (Tree a)Defined in containers-0.7 · Data.TreeGeneric (NonEmpty a)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (Identity a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.IdentityGeneric (First a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.MonoidGeneric (Last a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.MonoidGeneric (Down a)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (Dual a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalGeneric (Endo a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalGeneric (Product a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalGeneric (Sum a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalGeneric (ZipList a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Functor.ZipListGeneric (Par1 p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (Maybe a)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (Only_ a)Defined in optparse-generic-1.5.2 · Options.GenericGeneric (Doc a)Defined in pretty-1.1.3.6 · Text.PrettyPrint.Annotated.HughesPJGeneric (Doc ann)Defined in prettyprinter-1.7.1 · Prettyprinter.InternalGeneric (SimpleDocStream ann)Defined in prettyprinter-1.7.1 · Prettyprinter.InternalGeneric (SimpleDocTree ann)Defined in prettyprinter-1.7.1 · Prettyprinter.Render.Util.SimpleDocTreeGeneric (TyVarBndr flag)Defined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxGeneric (a)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric [a]Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (WrappedMonad m a)Defined in base-4.20.2.0 · Control.ApplicativeGeneric (Arg a b)Defined in base-4.20.2.0 · Data.SemigroupGeneric (Either a b)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (Proxy t)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (U1 p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (V1 p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (Lift f a)Defined in transformers-0.6.1.1 · Control.Applicative.LiftGeneric (MaybeT m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.MaybeGeneric (a, b)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (field <!> value)Defined in optparse-generic-1.5.2 · Options.GenericGeneric (field <#> value)Defined in optparse-generic-1.5.2 · Options.GenericGeneric (field <?> help)Defined in optparse-generic-1.5.2 · Options.GenericGeneric (WrappedArrow a b c)Defined in base-4.20.2.0 · Control.ApplicativeGeneric (Kleisli m a b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Control.ArrowGeneric (Const a b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.ConstGeneric (Ap f a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.MonoidGeneric (Alt f a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalGeneric (Rec1 f p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (URec Char p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (URec Double p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (URec Float p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (URec Int p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (URec Word p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (URec (Ptr ()) p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (Backwards f a)Defined in transformers-0.6.1.1 · Control.Applicative.BackwardsGeneric (AccumT w m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.AccumGeneric (ExceptT e m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.ExceptGeneric (IdentityT f a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.IdentityGeneric (ReaderT r m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.ReaderGeneric (SelectT r m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.SelectGeneric (StateT s m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.State.LazyGeneric (StateT s m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.State.StrictGeneric (WriterT w m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Writer.CPSGeneric (WriterT w m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Writer.LazyGeneric (WriterT w m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Writer.StrictGeneric (Constant a b)Defined in transformers-0.6.1.1 · Data.Functor.ConstantGeneric (Reverse f a)Defined in transformers-0.6.1.1 · Data.Functor.ReverseGeneric (a, b, c)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (Product f g a)Defined in base-4.20.2.0 · Data.Functor.ProductGeneric (Sum f g a)Defined in base-4.20.2.0 · Data.Functor.SumGeneric (K1 i c p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (ContT r m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.ContGeneric ((:*:) f g p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric ((:+:) f g p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (a, b, c, d)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (Compose f g a)Defined in base-4.20.2.0 · Data.Functor.ComposeGeneric (M1 i c f p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (RWST r w s m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.RWS.CPSGeneric (RWST r w s m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.RWS.LazyGeneric (RWST r w s m a)Defined in transformers-0.6.1.1 · Control.Monad.Trans.RWS.StrictGeneric ((:.:) f g p)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (a, b, c, d, e)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (a, b, c, d, e, f)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (a, b, c, d, e, f, g)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (a, b, c, d, e, f, g, h)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (a, b, c, d, e, f, g, h, i)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (a, b, c, d, e, f, g, h, i, j)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (a, b, c, d, e, f, g, h, i, j, k)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (a, b, c, d, e, f, g, h, i, j, k, l)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (a, b, c, d, e, f, g, h, i, j, k, l, m)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (a, b, c, d, e, f, g, h, i, j, k, l, m, n)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsGeneric (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)Defined in ghc-internal-9.1003.0 · GHC.Internal.GenericsA space efficient, packed, unboxed Unicode text type.
IsList TextDefined in text-2.1.3 · Data.Text · orphanPerforms replacement on invalid scalar values:
:set -XOverloadedLists['\55555'] :: Text"\65533"
Eq TextDefined in text-2.1.3 · Data.Text · orphanData TextDefined in text-2.1.3 · Data.Text · orphanThis instance preserves data abstraction at the cost of inefficiency. We omit reflection services for the sake of data abstraction.
This instance was created by copying the updated behavior of
Data.Set.Set and Data.Map.Data.Map.Map. If you
feel a mistake has been made, please feel free to submit
improvements.
The original discussion is archived here: could we get a Data instance for Data.Text.Text?
The followup discussion that changed the behavior of Set
and Data.Map.Map is archived here:
Proposal: Allow gunfold for Data.Map, ...
Ord TextDefined in text-2.1.3 · Data.Text · orphanRead TextDefined in text-2.1.3 · Data.Text · orphanShow TextDefined in text-2.1.3 · Data.Text.Show · orphanIsString TextDefined in text-2.1.3 · Data.Text · orphanPerforms replacement on invalid scalar values:
:set -XOverloadedStrings"\55555" :: Text"\65533"
Semigroup TextDefined in text-2.1.3 · Data.Text · orphanBeware: stimes will crash if the given number does not fit into
an Int.
Monoid TextDefined in text-2.1.3 · Data.Text · orphanPrintfArg TextDefined in text-2.1.3 · Data.Text · orphanNFData TextDefined in text-2.1.3 · Data.Text · orphanBinary TextDefined in text-2.1.3 · Data.Text · orphanPretty TextDefined in prettyprinter-1.7.1 · Prettyprinter.InternalParseField TextDefined in optparse-generic-1.5.2 · Options.GenericParseFields TextDefined in optparse-generic-1.5.2 · Options.GenericParseRecord TextDefined in optparse-generic-1.5.2 · Options.GenericLift TextDefined in text-2.1.3 · Data.Text · orphantype Item Text = CharDefined in text-2.1.3 · Data.Text · orphanBoolean monoid under conjunction (&&).
All x <> All y = All (x && y)All True <> mempty <> All False)All {getAll = False}
mconcat (map (\x -> All (even x)) [2,4,6,7,8])All {getAll = False}
All True <> memptyAll {getAll = True}
Bounded AllDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalEq AllDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalData AllDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.DataOrd AllDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalRead AllDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalShow AllDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalGeneric AllDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalSemigroup AllDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalMonoid AllDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalNFData AllDefined in deepseq-1.5.0.0 · Control.DeepSeqBinary AllDefined in binary-0.8.9.3 · Data.Binary.ClassParseField AllDefined in optparse-generic-1.5.2 · Options.GenericParseFields AllDefined in optparse-generic-1.5.2 · Options.GenericParseRecord AllDefined in optparse-generic-1.5.2 · Options.Generictype Rep All = D1 ('MetaData "All"
"GHC.Internal.Data.Semigroup.Internal"
"ghc-internal"
'True) (C1 ('MetaCons "All"
'PrefixI 'True) (S1 ('MetaSel ('Just "getAll"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool)))Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalBoolean monoid under disjunction (||).
Any x <> Any y = Any (x || y)Any True <> mempty <> Any FalseAny {getAny = True}
mconcat (map (\x -> Any (even x)) [2,4,6,7,8])Any {getAny = True}
Any False <> memptyAny {getAny = False}
Bounded AnyDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalEq AnyDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalData AnyDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.DataOrd AnyDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalRead AnyDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalShow AnyDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalGeneric AnyDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalSemigroup AnyDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalMonoid AnyDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalNFData AnyDefined in deepseq-1.5.0.0 · Control.DeepSeqBinary AnyDefined in binary-0.8.9.3 · Data.Binary.ClassParseField AnyDefined in optparse-generic-1.5.2 · Options.GenericParseFields AnyDefined in optparse-generic-1.5.2 · Options.GenericParseRecord AnyDefined in optparse-generic-1.5.2 · Options.Generictype Rep Any = D1 ('MetaData "Any"
"GHC.Internal.Data.Semigroup.Internal"
"ghc-internal"
'True) (C1 ('MetaCons "Any"
'PrefixI 'True) (S1 ('MetaSel ('Just "getAny"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool)))Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalMaybe monoid returning the leftmost non-Nothing value.
First a is isomorphic to Alt Maybe a, but precedes it
historically.
Beware that Data.Monoid.First is different from
Data.Semigroup.First. The former returns the first non-Nothing,
so Data.Monoid.First Nothing <> x = x. The latter simply returns the first value,
thus Data.Semigroup.First Nothing <> x = Data.Semigroup.First Nothing.
First (Just "hello") <> First Nothing <> First (Just "world")First {getFirst = Just "hello"}
First Nothing <> memptyFirst {getFirst = Nothing}
Monad FirstDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.MonoidFunctor FirstDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.MonoidMonadFix FirstDefined in ghc-internal-9.1003.0 · GHC.Internal.Control.Monad.FixApplicative FirstDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.MonoidFoldable FirstDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.FoldableTraversable FirstDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.TraversableMonadZip FirstDefined in base-4.20.2.0 · Control.Monad.ZipNFData1 FirstDefined in deepseq-1.5.0.0 · Control.DeepSeqGeneric1 FirstDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.MonoidEq a => Eq (First a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.MonoidData a => Data (First a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.DataOrd a => Ord (First a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.MonoidRead a => Read (First a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.MonoidShow a => Show (First a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.MonoidGeneric (First a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.MonoidSemigroup (First a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.MonoidMonoid (First a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.MonoidNFData a => NFData (First a)Defined in deepseq-1.5.0.0 · Control.DeepSeqBinary a => Binary (First a)Defined in binary-0.8.9.3 · Data.Binary.ClassParseField a => ParseFields (First a)Defined in optparse-generic-1.5.2 · Options.GenericParseField a => ParseRecord (First a)Defined in optparse-generic-1.5.2 · Options.Generictype Rep (First a) = D1 ('MetaData "First"
"GHC.Internal.Data.Monoid"
"ghc-internal"
'True) (C1 ('MetaCons "First"
'PrefixI 'True) (S1 ('MetaSel ('Just "getFirst"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe a))))Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Monoidtype Rep1 First = D1 ('MetaData "First"
"GHC.Internal.Data.Monoid"
"ghc-internal"
'True) (C1 ('MetaCons "First"
'PrefixI 'True) (S1 ('MetaSel ('Just "getFirst"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 Maybe)))Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.MonoidMaybe monoid returning the rightmost non-Nothing value.
Last a is isomorphic to Dual (First a), and thus to
Dual (Alt Maybe a)
Data.Semigroup.Last. The former returns the last non-Nothing,
so x <> Data.Monoid.Last Nothing = x. The latter simply returns the last value,
thus x <> Data.Semigroup.Last Nothing = Data.Semigroup.Last Nothing.
Last (Just "hello") <> Last Nothing <> Last (Just "world")Last {getLast = Just "world"}
Last Nothing <> memptyLast {getLast = Nothing}
Monad LastDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.MonoidFunctor LastDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.MonoidMonadFix LastDefined in ghc-internal-9.1003.0 · GHC.Internal.Control.Monad.FixApplicative LastDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.MonoidFoldable LastDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.FoldableTraversable LastDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.TraversableMonadZip LastDefined in base-4.20.2.0 · Control.Monad.ZipNFData1 LastDefined in deepseq-1.5.0.0 · Control.DeepSeqGeneric1 LastDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.MonoidEq a => Eq (Last a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.MonoidData a => Data (Last a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.DataOrd a => Ord (Last a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.MonoidRead a => Read (Last a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.MonoidShow a => Show (Last a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.MonoidGeneric (Last a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.MonoidSemigroup (Last a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.MonoidMonoid (Last a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.MonoidNFData a => NFData (Last a)Defined in deepseq-1.5.0.0 · Control.DeepSeqBinary a => Binary (Last a)Defined in binary-0.8.9.3 · Data.Binary.ClassParseField a => ParseFields (Last a)Defined in optparse-generic-1.5.2 · Options.GenericParseField a => ParseRecord (Last a)Defined in optparse-generic-1.5.2 · Options.Generictype Rep (Last a) = D1 ('MetaData "Last"
"GHC.Internal.Data.Monoid"
"ghc-internal"
'True) (C1 ('MetaCons "Last"
'PrefixI 'True) (S1 ('MetaSel ('Just "getLast"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe a))))Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Monoidtype Rep1 Last = D1 ('MetaData "Last"
"GHC.Internal.Data.Monoid"
"ghc-internal"
'True) (C1 ('MetaCons "Last"
'PrefixI 'True) (S1 ('MetaSel ('Just "getLast"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 Maybe)))Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.MonoidMonoid under addition.
Sum a <> Sum b = Sum (a + b)Sum 1 <> Sum 2 <> memptySum {getSum = 3}
mconcat [ Sum n | n <- [3 .. 9]]Sum {getSum = 42}
Monad SumDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalFunctor SumDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalMonadFix SumDefined in ghc-internal-9.1003.0 · GHC.Internal.Control.Monad.FixApplicative SumDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalFoldable SumDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.FoldableTraversable SumDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.TraversableMonadZip SumDefined in base-4.20.2.0 · Control.Monad.ZipFoldable1 SumDefined in base-4.20.2.0 · Data.Foldable1NFData1 SumDefined in deepseq-1.5.0.0 · Control.DeepSeqGeneric1 SumDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalBounded a => Bounded (Sum a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalEq a => Eq (Sum a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalData a => Data (Sum a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.DataNum a => Num (Sum a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalOrd a => Ord (Sum a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalRead a => Read (Sum a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalShow a => Show (Sum a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalGeneric (Sum a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalNum a => Semigroup (Sum a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalNum a => Monoid (Sum a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalNFData a => NFData (Sum a)Defined in deepseq-1.5.0.0 · Control.DeepSeqBinary a => Binary (Sum a)Defined in binary-0.8.9.3 · Data.Binary.Class(Num a, ParseField a) => ParseFields (Sum a)Defined in optparse-generic-1.5.2 · Options.Generic(Num a, ParseField a) => ParseRecord (Sum a)Defined in optparse-generic-1.5.2 · Options.Generictype Rep (Sum a) = D1 ('MetaData "Sum"
"GHC.Internal.Data.Semigroup.Internal"
"ghc-internal"
'True) (C1 ('MetaCons "Sum"
'PrefixI 'True) (S1 ('MetaSel ('Just "getSum"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.Internaltype Rep1 Sum = D1 ('MetaData "Sum"
"GHC.Internal.Data.Semigroup.Internal"
"ghc-internal"
'True) (C1 ('MetaCons "Sum"
'PrefixI 'True) (S1 ('MetaSel ('Just "getSum"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1))Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalMonoid under multiplication.
Product x <> Product y == Product (x * y)Product 3 <> Product 4 <> memptyProduct {getProduct = 12}
mconcat [ Product n | n <- [2 .. 10]]Product {getProduct = 3628800}
ProductgetProduct :: aMonad ProductDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalFunctor ProductDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalMonadFix ProductDefined in ghc-internal-9.1003.0 · GHC.Internal.Control.Monad.FixApplicative ProductDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalFoldable ProductDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.FoldableTraversable ProductDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.TraversableMonadZip ProductDefined in base-4.20.2.0 · Control.Monad.ZipFoldable1 ProductDefined in base-4.20.2.0 · Data.Foldable1NFData1 ProductDefined in deepseq-1.5.0.0 · Control.DeepSeqGeneric1 ProductDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalBounded a => Bounded (Product a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalEq a => Eq (Product a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalData a => Data (Product a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.DataNum a => Num (Product a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalOrd a => Ord (Product a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalRead a => Read (Product a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalShow a => Show (Product a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalGeneric (Product a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalNum a => Semigroup (Product a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalNum a => Monoid (Product a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.InternalNFData a => NFData (Product a)Defined in deepseq-1.5.0.0 · Control.DeepSeqBinary a => Binary (Product a)Defined in binary-0.8.9.3 · Data.Binary.Class(Num a, ParseField a) => ParseFields (Product a)Defined in optparse-generic-1.5.2 · Options.Generic(Num a, ParseField a) => ParseRecord (Product a)Defined in optparse-generic-1.5.2 · Options.Generictype Rep (Product a) = D1 ('MetaData "Product"
"GHC.Internal.Data.Semigroup.Internal"
"ghc-internal"
'True) (C1 ('MetaCons "Product"
'PrefixI 'True) (S1 ('MetaSel ('Just "getProduct"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.Internaltype Rep1 Product = D1 ('MetaData "Product"
"GHC.Internal.Data.Semigroup.Internal"
"ghc-internal"
'True) (C1 ('MetaCons "Product"
'PrefixI 'True) (S1 ('MetaSel ('Just "getProduct"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1))Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.Internal