HORIZON HASKELLDocslts/ghc-10.0.x8c2f8e82026-10-19Search names, modules, packages, or :: a typeCtrl K

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8c2f8e8 · 2026-10-19

Moduleopaleye-0.10.8.0Haskell2010

Opaleye.Internal.PackMap

  • 2 types
  • 11 values
  • Packageopaleye-0.10.8.0
  • Exports13
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourcePackMap.hs
newtypenewtype PackMap a b s t
#

A PackMap a b s t encodes how an s contains an updatable sequence of a inside it. Each a in the sequence can be updated to a b (and the s changes to a t to reflect this change of type).

PackMap is just like a Traversal from the lens package. PackMap has a different order of arguments to Traversal because it typically needs to be made a Profunctor (and indeed ProductProfunctor) in s and t. It is unclear at this point whether we want the same Traversal laws to hold or not. Our use cases may be much more general.

Constructors

Instances5Profunctor, ProductProfunctor, SumProfunctor, Functor, Applicative
valuetraversePM :: Applicative f => PackMap a b s t -> (a -> f b) -> s -> f t
#

Replaces the targeted occurrences of a in s with b (changing the s to a t in the process). This can be done via an Applicative action.

traversePM is just like traverse from the lens package. traversePM used to be called packmap.

valueoverPM :: PackMap a b s t -> (a -> b) -> s -> t
#

Modify the targeted occurrences of a in s with b (changing the s to a t in the process).

overPM is just like over from the lens package.

typetype PM a = State (a, Int)
#

A helpful monad for writing columns in the AST

valuerun :: PM [a] r -> (r, [a])
#
valueextractAttrPE
  1. :: primExpr -> String -> String
  2. -> Tag
  3. -> primExpr
  4. -> PM [(Symbol, primExpr)] PrimExpr
#

Make a fresh name for an input value (the variable primExpr type is typically actually a PrimExpr) based on the supplied function and the unique Tag that is used as part of our QueryArr.

Add the fresh name and the input value it refers to the list in the state parameter.

valueiso :: (s -> a) -> (b -> t) -> PackMap a b s t
#

Like iso. In practice it won't actually be used as an isomorphism, but it seems to be appropriate anyway.