packages feed

polytropos-profunctors 0.1.0.3 → 0.1.0.4

raw patch · API changes only · 3 files changed · show whitespace changes · browse polytropos-profunctors-0.1.0.4

+15/−9 lines, 3 filesdep ~polytropos-coredep ~polytropos-pluginPVP: major bump suggested

Dependency ranges changed: polytropos-core, polytropos-plugin

API changes (from Hackage documentation)

0 removed, 0 added, 1 changed

API removals or changes: PVP suggests a major version bump

- Polytropos.Profunctors: ctorPrism :: forall (c :: Symbol) (s :: SumRow) (fs :: Row). ConstructorIndex c s => Field c -> Prism' (Variant s) (Record fs)
+ Polytropos.Profunctors: ctorPrism :: forall (c :: Symbol) (s :: SumRow) (fs :: Row). (ConstructorIndex c s, fs ~ ConstructorPayload c s) => Field c -> Prism' (Variant s) (Record fs)

Files

CHANGELOG.md view
@@ -1,5 +1,10 @@ # Changelog for polytropos-profunctors +## 0.1.0.4 — 2026-11-22++- Constrain `ctorPrism` constructor payload type to `ConstructorPayload c s`.+- Require `polytropos-core >= 0.1.2.0 && < 0.2`.+ ## 0.1.0.1 — Initial Release (2026-10-20)  - Integration with the `profunctors` ecosystem for open records and variants
polytropos-profunctors.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: polytropos-profunctors-version: 0.1.0.3+version: 0.1.0.4 synopsis: Pure profunctor optics for polytropos open records and variants description:   Integration between <https://hackage.haskell.org/package/polytropos polytropos> and the@@ -41,7 +41,7 @@     primitive >= 0.7 && < 1,     profunctors >= 5.6 && < 6,     tagged >= 0.8 && < 1,-    polytropos-core >= 0.1 && < 0.2+    polytropos-core >= 0.1.2.0 && < 0.2  test-suite polytropos-profunctors-test   type: exitcode-stdio-1.0@@ -54,8 +54,8 @@     primitive,     profunctors,     tagged,-    polytropos-core,+    polytropos-core >= 0.1.2.0 && < 0.2,     polytropos-profunctors,-    polytropos-plugin,+    polytropos-plugin >= 0.1.2.0 && < 0.2,     tasty,     tasty-hunit
src/Polytropos/Profunctors.hs view
@@ -108,6 +108,7 @@ import Polytropos   ( Record   , Variant+  , ConstructorPayload   , Field(..)   , injectVariant   )@@ -148,7 +149,7 @@ prism' build match = prism build (\s -> maybe (Left s) Right (match s)) {-# INLINE prism' #-} --- | Extract the target of a lens using the 'Forget' profunctor.+-- | Extract the target of a lens using the 't:Forget' profunctor. view :: Lens' s a -> s -> a view l = runForget (l (Forget id)) {-# INLINE view #-}@@ -158,7 +159,7 @@ preview p = getFirst . runForget (p (Forget (First . Just))) {-# INLINE preview #-} --- | Inject a target into a sum using the 'Tagged' profunctor.+-- | Inject a target into a sum using the 't:Tagged' profunctor. review :: Prism' s a -> a -> s review p = unTagged . p . Tagged {-# INLINE review #-}@@ -177,7 +178,7 @@ -- High-Level Row Lenses & Prisms -------------------------------------------------------------------------------- --- | A typed profunctor lens focusing on an open 'Record' field specified by 'Field',+-- | A typed profunctor lens focusing on an open 'Record' field specified by 't:Field', -- resolved at compile time via 'FieldIndex'. fieldLens :: forall n r a. FieldIndex n r a => Field n -> Lens' (Record r) a fieldLens _ = lens getter setter@@ -189,9 +190,9 @@       in RowRep (setFieldAt idx boxed r) {-# INLINE fieldLens #-} --- | A typed profunctor prism focusing on an open 'Variant' constructor specified by 'Field',+-- | A typed profunctor prism focusing on an open 'Variant' constructor specified by 't:Field', -- resolved at compile time via 'ConstructorIndex'.-ctorPrism :: forall c s fs. ConstructorIndex c s => Field c -> Prism' (Variant s) (Record fs)+ctorPrism :: forall c s fs. (ConstructorIndex c s, fs ~ ConstructorPayload c s) => Field c -> Prism' (Variant s) (Record fs) ctorPrism f = prism (injectVariant f) project   where     cIdx = constructorIndex @_ @c @s