to :: (s -> a) -> Getter s t a b
to promotes a projection function to a read-only lens called a getter.
To demote a lens to a projection function, use the section (^.l) or view l.
(3 :+ 4, "example")^._1.to(abs)5.0 :+ 0.0
:: a typeCtrl KGHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05
Modulelens-family-core-2.1.3Haskell2010
This is the main module for end-users of lens-families-core. If you are not building your own optics such as lenses, traversals, grates, etc., but just using optics made by others, this is the only module you need.
This module provides ^. for accessing fields and .~ and %~ for setting and modifying fields.
Lenses are composed with . from the Prelude and id is the identity lens.
Lens composition in this library enjoys the following identities.
x^.l1.l2 === x^.l1^.l2l1.l2 %~ f === l1 %~ l2 %~ fThe identity lens behaves as follows.
x^.id === xid %~ f === fThe & operator, allows for a convenient way to sequence record updating:
record & l1 .~ value1 & l2 .~ value2Lenses are implemented in van Laarhoven style.
Lenses have type Functor f => (a -> f a) -> s -> f s and lens families have type Functor f => (a i -> f (a j)) -> s i -> f (s j).
Keep in mind that lenses and lens families can be used directly for functorial updates.
For example, _2 id gives you strength.
_2 id :: Functor f => (a, f b) -> f (a, b)Here is an example of code that uses the Maybe functor to preserves sharing during update when possible.
-- | 'sharedUpdate' returns the *identical* object if the update doesn't change anything.
-- This is useful for preserving sharing.
sharedUpdate :: Eq a => LensLike' Maybe s a -> (a -> a) -> s -> s
sharedUpdate l f s = fromMaybe s (l f' s)
where
f' a | b == a = Nothing
| otherwise = Just b
where
b = f a^. can be used with traversals to access monoidal fields.
The result will be a Data.Monid.mconcat of all the fields referenced.
The various fooOf functions can be used to access different monoidal summaries of some kinds of values.
^? can be used to access the first value of a traversal. Nothing is returned when the traversal has no references.
^.. can be used with a traversals and will return a list of all fields referenced.
When .~ is used with a traversal, all referenced fields will be set to the same value, and when %~ is used with a traversal, all referenced fields will be modified with the same function.
A variant of ^? call matching returns Either a Right value which is the first value of the traversal, or a Left value which is a "proof" that the traversal has no elements. The "proof" consists of the original input structure, but in the case of polymorphic families, the type parameter is replaced with a fresh type variable, thus proving that the type parameter was unused.
Like all optics, traversals can be composed with ., and because every lens is automatically a traversal, lenses and traversals can be composed with . yielding a traversal.
Traversals are implemented in van Laarhoven style.
Traversals have type Applicative f => (a -> f a) -> s -> f s and traversal families have type Applicative f => (a i -> f (a j)) -> s i -> f (s j).
zipWithOf can be used with grates to zip two structure together provided a binary operation.
under can be used to modify each value in a structure according to a function. This works analogous to how over works for lenses and traversals.
review can be used with grates to construct a constant grate from a single value. This is like a 0-ary zipWith function.
degrating can be used to build higher arity zipWithOf functions:
zipWith3Of :: AGrate s t a b -> (a -> a -> a -> b) -> s -> s -> s -> t
zipWith3Of l f s1 s2 s3 = degrating l (\k -> f (k s1) (k s2) (k s3))Like all optics, grates can be composed with ., and id is the identity grate.
Grates are implemented in van Laarhoven style.
Grates have type Functor g => (g a -> a) -> g s -> s and grate families have type Functor g => (g (a i) -> a j) -> g (s i) -> s j.
Keep in mind that grates and grate families can be used directly for functorial zipping. For example,
both sum :: Num a => [(a, a)] -> (a, a)will take a list of pairs return the sum of the first components and the sum of the second components. For another example,
cod id :: Functor f => f (r -> a) -> r -> f awill turn a functor full of functions into a function returning a functor full of results.
The Adapter, Prism, and Grid optics are all AdapterLike optics and typically not used directly, but either converted to a LensLike optic using under, or into a GrateLike optic using over. See under and over for details about which conversions are possible.
These optics are implemented in van Laarhoven style.
Adapters have type (Functor f, Functor g) => (g a -> f a) -> g s -> f s and Adapters families have type (Functor f, Functor g) => (g (a i) -> f (a j)) -> g (s i) -> f (s j).
Grids have type (Applicative f, Functor g) => (g a -> f a) -> g s -> f s and Grids families have type (Applicative f, Functor g) => (g (a i) -> f (a j)) -> g (s i) -> f (s j).
Prisms have type (Applicative f, Traversable g) => (g a -> f a) -> g s -> f s and Prisms families have type (Applicative f, Traversable g) => (g (a i) -> f (a j)) -> g (s i) -> f (s j).
Keep in mind that these optics and their families can sometimes be used directly, without using over and under. Sometimes you can take advantage of the fact that
LensLike f (g s) t (g a) b
==
AdapterLike f g s t a b
==
GrateLike g s (f t) a (f b)
For example, if you have a grid for your structure to another type that has an Arbitray instance, such as grid from a custom word type to Bool, e.g. myWordBitVector :: (Applicative f, Functor g) => AdapterLike' f g MyWord Bool, you can use the grid to create an Arbitrary instance for your structure by directly applying review:
instance Arbitrary MyWord where
arbitrary = review myWordBitVector arbitraryTo build your own optics, see Lens.Family.Unchecked.
For stock optics, see Lens.Family.Stock.
References:
to :: (s -> a) -> Getter s t a b
to promotes a projection function to a read-only lens called a getter.
To demote a lens to a projection function, use the section (^.l) or view l.
(3 :+ 4, "example")^._1.to(abs)5.0 :+ 0.0
view :: Getter s t a b -> s -> a
Demote a lens or getter to a projection function.
view :: Monoid a => Fold s t a b -> s -> a
Returns the monoidal summary of a traversal or a fold.
(^.) :: s -> Getter s t a b -> a
Access the value referenced by a getter or lens.
(^.) :: Monoid a => s -> Fold s t a b -> a
Access the monoidal summary referenced by a traversal or a fold.
folding :: (s -> [a]) -> Fold s t a b
folding promotes a "toList" function to a read-only traversal called a fold.
To demote a traversal or fold to a "toList" function use the section (^..l) or toListOf l.
views :: Monoid r => Fold s t a b -> (a -> r) -> s -> r
Given a fold or traversal, return the foldMap of all the values using the given function.
views :: Getter s t a b -> (a -> r) -> s -> r
views is not particularly useful for getters or lenses, but given a getter or lens, it returns the referenced value passed through the given function.
views l f s = f (view l s)
(^..) :: s -> Fold s t a b -> [a]
Returns a list of all of the referenced values in order.
toListOf :: Fold s t a b -> s -> [a]
Returns a list of all of the referenced values in order.
allOf :: Fold s t a b -> (a -> Bool) -> s -> Bool
Returns true if all of the referenced values satisfy the given predicate.
anyOf :: Fold s t a b -> (a -> Bool) -> s -> Bool
Returns true if any of the referenced values satisfy the given predicate.
sumOf :: Num a => Fold s t a b -> s -> a
Returns the sum of all the referenced values.
productOf :: Num a => Fold s t a b -> s -> a
Returns the product of all the referenced values.
lengthOf :: Num r => Fold s t a b -> s -> r
Counts the number of references in a traversal or fold for the input.
nullOf :: Fold s t a b -> s -> Bool
Returns true if the number of references in the input is zero.
matching :: Traversal s t a b -> s -> Either t a
Returns Right of the first referenced value. Returns Left the original value when there are no referenced values. In case there are no referenced values, the result might have a fresh type parameter, thereby proving the original value had no referenced values.
over :: Setter s t a b -> (a -> b) -> s -> t
Demote a setter to a semantic editor combinator.
over :: Prism s t a b -> Reviwer s t a b
over :: Grid s t a b -> Grate s t a b
over :: Adapter s t a b -> Grate s t a b
Covert an AdapterLike optic into a GrateLike optic.
Modify all referenced fields.
Set all referenced fields to the given value.
Set all referenced fields to the given value.
review :: Grate s t a b -> b -> t
review :: Reviewer s t a b -> b -> t
zipWithOf :: Grate s t a b -> (a -> a -> b) -> s -> s -> t
Returns a binary instance of a grate.
zipWithOf l f x y = degrating l (k -> f (k x) (k y))
degrating :: Grate s t a b -> ((s -> a) -> b) -> t
Demote a grate to its normal, higher-order function, form.
degrating . grate = id
grate . degrating = id
under :: Resetter s t a b -> (a -> b) -> s -> t
Demote a resetter to a semantic editor combinator.
under :: Prism s t a b -> Traversal s t a b
under :: Grid s t a b -> Traversal s t a b
under :: Adapter s t a b -> Lens s t a b
Covert an AdapterLike optic into a LensLike optic.
Note: this function is unrelated to the lens package's under function.
reset :: Resetter s t a b -> b -> s -> t
Set all referenced fields to the given value.
A flipped version of ($).
Monoidally append a value to all referenced fields.
Phantom (Const a)Defined in lens-family-core-2.1.3 · Lens.Family.PhantomPhantom (Constant a)Defined in lens-family-core-2.1.3 · Lens.Family.PhantomPhantom f => Phantom (AlongsideLeft f a)Defined in lens-family-core-2.1.3 · Lens.Family.StockPhantom f => Phantom (AlongsideRight f a)Defined in lens-family-core-2.1.3 · Lens.Family.StockPhantom f => Phantom (Backwards f)Defined in lens-family-core-2.1.3 · Lens.Family.PhantomPhantom g => Phantom (FromG e g)Defined in lens-family-core-2.1.3 · Lens.Family.StockPhantom g => Phantom (FromF i j g)Defined in lens-family-core-2.1.3 · Lens.Family.Stock(Phantom f, Functor g) => Phantom (Compose f g)Defined in lens-family-core-2.1.3 · Lens.Family.PhantomConstant functor.
Generic1 (Constant a)Defined in transformers-0.6.1.1 · Data.Functor.ConstantBifoldable ConstantDefined in transformers-0.6.1.1 · Data.Functor.ConstantBifunctor ConstantDefined in transformers-0.6.1.1 · Data.Functor.ConstantBitraversable ConstantDefined in transformers-0.6.1.1 · Data.Functor.ConstantEq2 ConstantDefined in transformers-0.6.1.1 · Data.Functor.ConstantOrd2 ConstantDefined in transformers-0.6.1.1 · Data.Functor.ConstantRead2 ConstantDefined in transformers-0.6.1.1 · Data.Functor.ConstantShow2 ConstantDefined in transformers-0.6.1.1 · Data.Functor.ConstantFunctor (Constant a)Defined in transformers-0.6.1.1 · Data.Functor.ConstantMonoid a => Applicative (Constant a)Defined in transformers-0.6.1.1 · Data.Functor.ConstantFoldable (Constant a)Defined in transformers-0.6.1.1 · Data.Functor.ConstantTraversable (Constant a)Defined in transformers-0.6.1.1 · Data.Functor.ConstantEq a => Eq1 (Constant a)Defined in transformers-0.6.1.1 · Data.Functor.ConstantOrd a => Ord1 (Constant a)Defined in transformers-0.6.1.1 · Data.Functor.ConstantRead a => Read1 (Constant a)Defined in transformers-0.6.1.1 · Data.Functor.ConstantShow a => Show1 (Constant a)Defined in transformers-0.6.1.1 · Data.Functor.ConstantContravariant (Constant a)Defined in transformers-0.6.1.1 · Data.Functor.ConstantPhantom (Constant a)Defined in lens-family-core-2.1.3 · Lens.Family.PhantomEq a => Eq (Constant a b)Defined in transformers-0.6.1.1 · Data.Functor.Constant(Typeable b, Typeable k, Data a) => Data (Constant a b)Defined in transformers-0.6.1.1 · Data.Functor.ConstantOrd a => Ord (Constant a b)Defined in transformers-0.6.1.1 · Data.Functor.ConstantRead a => Read (Constant a b)Defined in transformers-0.6.1.1 · Data.Functor.ConstantShow a => Show (Constant a b)Defined in transformers-0.6.1.1 · Data.Functor.ConstantGeneric (Constant a b)Defined in transformers-0.6.1.1 · Data.Functor.ConstantSemigroup a => Semigroup (Constant a b)Defined in transformers-0.6.1.1 · Data.Functor.ConstantMonoid a => Monoid (Constant a b)Defined in transformers-0.6.1.1 · Data.Functor.Constanttype Rep (Constant a b) = D1 ('MetaData "Constant"
"Data.Functor.Constant"
"transformers-0.6.1.1-a11a"
'True) (C1 ('MetaCons "Constant"
'PrefixI 'True) (S1 ('MetaSel ('Just "getConstant"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))Defined in transformers-0.6.1.1 · Data.Functor.Constanttype Rep1 (Constant a) = D1 ('MetaData "Constant"
"Data.Functor.Constant"
"transformers-0.6.1.1-a11a"
'True) (C1 ('MetaCons "Constant"
'PrefixI 'True) (S1 ('MetaSel ('Just "getConstant"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))Defined in transformers-0.6.1.1 · Data.Functor.ConstantIdentity functor and monad. (a non-strict monad)
fmap (+1) (Identity 0)Identity 1
Identity [1, 2, 3] <> Identity [4, 5, 6]Identity [1,2,3,4,5,6]
>>> do
x <- Identity 10
y <- Identity (x + 5)
pure (x + y)
Identity 25
Monad IdentityDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.IdentityFunctor IdentityDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.IdentityMonadFix IdentityDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.IdentityApplicative IdentityDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.IdentityFoldable IdentityDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.IdentityTraversable IdentityDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.TraversableMonadZip IdentityDefined in base-4.20.2.0 · Control.Monad.ZipFoldable1 IdentityDefined in base-4.20.2.0 · Data.Foldable1Eq1 IdentityDefined in base-4.20.2.0 · Data.Functor.ClassesOrd1 IdentityDefined in base-4.20.2.0 · Data.Functor.ClassesRead1 IdentityDefined in base-4.20.2.0 · Data.Functor.ClassesShow1 IdentityDefined in base-4.20.2.0 · Data.Functor.ClassesNFData1 IdentityDefined in deepseq-1.5.0.0 · Control.DeepSeqIdentical IdentityDefined in lens-family-core-2.1.3 · Lens.Family.IdenticalGeneric1 IdentityDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.IdentityBounded a => Bounded (Identity a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.IdentityEnum a => Enum (Identity a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.IdentityEq a => Eq (Identity a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.IdentityFloating a => Floating (Identity a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.IdentityFractional a => Fractional (Identity a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.IdentityIntegral a => Integral (Identity a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.IdentityData a => Data (Identity a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.DataNum a => Num (Identity a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.IdentityOrd a => Ord (Identity a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.IdentityRead a => Read (Identity a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.IdentityThis instance would be equivalent to the derived instances of the Identity newtype if the runIdentity field were removed
Real a => Real (Identity a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.IdentityRealFloat a => RealFloat (Identity a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.IdentityRealFrac a => RealFrac (Identity a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.IdentityShow a => Show (Identity a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.IdentityThis instance would be equivalent to the derived instances of the Identity newtype if the runIdentity field were removed
Ix a => Ix (Identity a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.IdentityIsString a => IsString (Identity a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.StringGeneric (Identity a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.IdentitySemigroup a => Semigroup (Identity a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.IdentityMonoid a => Monoid (Identity a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.IdentityBits a => Bits (Identity a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.IdentityFiniteBits a => FiniteBits (Identity a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.IdentityStorable a => Storable (Identity a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.IdentityNFData a => NFData (Identity a)Defined in deepseq-1.5.0.0 · Control.DeepSeqtype Rep (Identity a) = D1 ('MetaData "Identity"
"GHC.Internal.Data.Functor.Identity"
"ghc-internal"
'True) (C1 ('MetaCons "Identity"
'PrefixI 'True) (S1 ('MetaSel ('Just "runIdentity"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.Identitytype Rep1 Identity = D1 ('MetaData "Identity"
"GHC.Internal.Data.Functor.Identity"
"ghc-internal"
'True) (C1 ('MetaCons "Identity"
'PrefixI 'True) (S1 ('MetaSel ('Just "runIdentity"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1))Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.IdentityBoolean 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.DeepSeqtype 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.DeepSeqtype 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.InternalMonoid 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.DeepSeqtype 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}
Monad 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.DeepSeqtype 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