distributors-0.2.0.1: Unifying Parsers, Printers & Grammars
Copyright(C) 2025 - Eitan Chatav
LicenseBSD-style (see the file LICENSE)
MaintainerEitan Chatav <eitan.chatav@gmail.com>
Stabilityprovisional
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Control.Lens.Internal.NestedPrismTH

Description

Code is duplicated from PrismTH, with small tweaks to support nested pairs.

Synopsis

Nested Prisms

makeNestedPrisms :: Name -> DecsQ Source #

Generate a Prism for each constructor of a data type. Isos generated when possible. Reviews 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.