packages feed

one-liner 2.0 → 2.1

raw patch · 4 files changed

+14/−6 lines, 4 filesdep ~linear-basedep ~transformers

Dependency ranges changed: linear-base, transformers

Files

CHANGELOG view
@@ -1,5 +1,8 @@ CHANGELOG +2.0 -> 2.1+  - Fix duplicate instance `Profunctor` `FUN` with linear-base 0.2+ 1.0 -> 2.0   - Require GHC 9   - Change Generics.OneLiner.Internal to use linear profunctors
one-liner.cabal view
@@ -1,6 +1,6 @@ cabal-version:        2.0 name:                 one-liner-version:              2.0+version:              2.1 synopsis:             Constraint-based generics description:          Write short and concise generic instances of type classes.                       one-liner is particularly useful for writing default@@ -13,6 +13,7 @@ maintainer:           sjoerd@w3future.com category:             Generics build-type:           Simple+tested-with:          GHC==9.0.1, GHC==9.2.1  extra-source-files:   examples/*.hs
src/Generics/OneLiner.hs view
@@ -184,9 +184,9 @@ gfoldMap f = getConst . gtraverse @c (Const . f) {-# INLINE gfoldMap #-} --- | Map each component of a structure to a monoid, and combine the results.+-- | Map each component of a structure to a linear monoid, and combine the results. ----- If you have a class `Size`, which measures the size of a structure, then this could be the default implementation:+-- For example. this could be the default implementation of `Linear.Consumable`: -- -- @ -- consume = `glfoldMap` \@`Linear.Consumable` `Linear.consume`@@ -208,6 +208,8 @@  -- | Map each component of a structure to an action linearly, evaluate these actions from left to right, and collect the results. --+-- For example. this could be the default implementations of `Linear.Dupable` and `Linear.Movable`:+-- -- @ -- dupV = `gltraverse` \@`Linear.Dupable` `Linear.dupV` -- move = `gltraverse` \@`Linear.Movable` `Linear.move`@@ -280,7 +282,7 @@ gltraverse01 f = dimap Kleisli runKleisli $ generic01 @Linear.Movable @c (Kleisli (\a -> urpure (Linear.move a))) $ dimap runKleisli Kleisli f {-# INLINE gltraverse01 #-} -urpure :: DL.Applicative f => Linear.Ur a %1 -> f a+urpure :: DL.Applicative f => Linear.Ur a %1-> f a urpure (Linear.Ur a) = DL.pure a  -- | Combine two values by combining each component of the structures to a monoid, and combine the results.
src/Generics/OneLiner/Classes.hs view
@@ -10,7 +10,8 @@ ----------------------------------------------------------------------------- {-# OPTIONS -Wno-orphans #-} {-# LANGUAGE-    EmptyCase+    CPP+  , EmptyCase   , LambdaCase   , LinearTypes   , TypeOperators@@ -86,9 +87,10 @@ class Profunctor p => GenericEmptyProfunctor p where   zero :: p (V1 a) (V1 a') -+#if !MIN_VERSION_linear_base(0,2,0) instance Profunctor (FUN 'One) where   dimap f g h = \x -> g (h (f x))+#endif instance GenericUnitProfunctor (FUN 'One) where   unit U1 = U1   {-# INLINE unit #-}