Copyright | (C) 2025 - Eitan Chatav |
---|---|
License | BSD-style (see the file LICENSE) |
Maintainer | Eitan Chatav <eitan.chatav@gmail.com> |
Stability | provisional |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
Control.Lens.Internal.NestedPrismTH
Contents
Description
Code is duplicated from PrismTH
,
with small tweaks to support nested pairs.
Synopsis
- makeNestedPrisms :: Name -> DecsQ
Nested Prisms
makeNestedPrisms :: Name -> DecsQ Source #
Generate a Prism
for each constructor of a data type.
Iso
s generated when possible.
Review
s are created for constructors with existentially
quantified constructors and GADTs.
See makePrisms
for details and examples.
The difference in makeNestedPrisms
is that constructors with n > 2
arguments
will use right-nested pairs, rather than a flat n
-tuple.
This makes them suitable for use on the left-hand-side of
>?
and >?<
;
with repeated use of >*<
on the right-hand-side, resulting in right-nested pairs.