Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
foldMap
for sum types where constructors are encoded by mapping the
constructor name.
Note that constructor names are unique per type. So as long as your mapping
function similarly outputs unique values of your monoid for each constructor,
you should be able to "reverse" the process (e.g. for generic traverse
).
Synopsis
- class GFoldMapSum tag gf where
- gFoldMapSum :: (String -> GenericFoldMapM tag) -> gf p -> GenericFoldMapM tag
- class GFoldMapCSum tag gf where
- gFoldMapCSum :: (String -> GenericFoldMapM tag) -> gf p -> GenericFoldMapM tag
Documentation
class GFoldMapSum tag gf where Source #
gFoldMapSum :: (String -> GenericFoldMapM tag) -> gf p -> GenericFoldMapM tag Source #
Instances
GFoldMapSum (tag :: k1) (V1 :: k2 -> Type) Source # | |
Defined in Generic.Data.Function.FoldMap.Sum gFoldMapSum :: forall (p :: k10). (String -> GenericFoldMapM tag) -> V1 p -> GenericFoldMapM tag Source # | |
GFoldMapCSum tag (l :+: r) => GFoldMapSum (tag :: k1) (l :+: r :: k2 -> Type) Source # | |
Defined in Generic.Data.Function.FoldMap.Sum gFoldMapSum :: forall (p :: k10). (String -> GenericFoldMapM tag) -> (l :+: r) p -> GenericFoldMapM tag Source # | |
GFoldMapCSum tag (C1 c gf) => GFoldMapSum (tag :: k1) (C1 c gf :: k2 -> Type) Source # | |
Defined in Generic.Data.Function.FoldMap.Sum gFoldMapSum :: forall (p :: k10). (String -> GenericFoldMapM tag) -> C1 c gf p -> GenericFoldMapM tag Source # | |
GFoldMapSum tag gf => GFoldMapSum (tag :: k1) (D1 c gf :: k2 -> Type) Source # | |
Defined in Generic.Data.Function.FoldMap.Sum gFoldMapSum :: forall (p :: k10). (String -> GenericFoldMapM tag) -> D1 c gf p -> GenericFoldMapM tag Source # |
class GFoldMapCSum tag gf where Source #
Sum type handler prefixing constructor contents with their mapped
constructor name via a provided String -> m
.
TODO rename
gFoldMapCSum :: (String -> GenericFoldMapM tag) -> gf p -> GenericFoldMapM tag Source #
Instances
(GFoldMapCSum tag l, GFoldMapCSum tag r) => GFoldMapCSum (tag :: k1) (l :+: r :: k2 -> Type) Source # | |
Defined in Generic.Data.Function.FoldMap.Sum gFoldMapCSum :: forall (p :: k10). (String -> GenericFoldMapM tag) -> (l :+: r) p -> GenericFoldMapM tag Source # | |
(Semigroup (GenericFoldMapM tag), Constructor c, GFoldMapC tag gf) => GFoldMapCSum (tag :: k1) (C1 c gf :: k2 -> Type) Source # | |
Defined in Generic.Data.Function.FoldMap.Sum gFoldMapCSum :: forall (p :: k10). (String -> GenericFoldMapM tag) -> C1 c gf p -> GenericFoldMapM tag Source # |