papa 0.4.0 → 0.5.0
raw patch · 42 files changed
+105/−84 lines, 42 filesdep −lens-indexed-plateddep ~one
Dependencies removed: lens-indexed-plated
Dependency ranges changed: one
Files
- changelog.md +16/−0
- papa.cabal +7/−11
- src/Papa.hs +1/−3
- src/Papa/Adjunctions.hs +1/−1
- src/Papa/Adjunctions/Renamed.hs +1/−1
- src/Papa/Associative.hs +1/−1
- src/Papa/Associative/Renamed.hs +1/−1
- src/Papa/Base.hs +7/−1
- src/Papa/Base/Control/Arrow.hs +1/−1
- src/Papa/Base/Control/Monad.hs +2/−1
- src/Papa/Base/Data/Either.hs +6/−6
- src/Papa/Base/Data/Foldable.hs +3/−0
- src/Papa/Base/Data/Function.hs +1/−0
- src/Papa/Base/Data/Functor.hs +2/−1
- src/Papa/Base/Data/List.hs +9/−7
- src/Papa/Base/Data/List/NonEmpty.hs +8/−7
- src/Papa/Base/Data/Monoid.hs +1/−0
- src/Papa/Base/Data/Ord.hs +4/−4
- src/Papa/Base/Data/Show.hs +1/−1
- src/Papa/Base/Data/Traversable.hs +3/−0
- src/Papa/Bifunctors/Data/Bifoldable.hs +2/−0
- src/Papa/Comonad.hs +1/−1
- src/Papa/Comonad/Renamed.hs +1/−1
- src/Papa/Containers.hs +1/−2
- src/Papa/Free.hs +1/−2
- src/Papa/Id.hs +1/−2
- src/Papa/Lens/Data/List.hs +1/−0
- src/Papa/LensIndexedPlated.hs +0/−8
- src/Papa/LensIndexedPlated/Control/Lens/IndexedPlated.hs +0/−8
- src/Papa/One.hs +1/−1
- src/Papa/One/Renamed.hs +1/−1
- src/Papa/Polytree.hs +1/−1
- src/Papa/Polytree/Renamed.hs +5/−4
- src/Papa/Profunctors.hs +1/−1
- src/Papa/Profunctors/Renamed.hs +1/−1
- src/Papa/Selective.hs +1/−1
- src/Papa/Selective/Renamed.hs +1/−1
- src/Papa/Semigroupoids/Data/Functor/Bind.hs +2/−0
- src/Papa/Semigroupoids/Data/Semigroup/Foldable.hs +2/−0
- src/Papa/Witherable.hs +1/−1
- src/Papa/Witherable/Renamed.hs +1/−1
- test/Main.hs +3/−0
changelog.md view
@@ -1,3 +1,19 @@+0.5.0++* Remove `lens-indexed-plated` dependency to resolve GHC 9.12+ compatibility+* Add GHC 9.12.4 support+* Fix GHC 9.8+ compatibility by hiding `uncons`/`unsnoc` from `Papa.Base`+* Update CI to use `cabal build all` for multi-package project support+* Add `one >= 0.0.4` constraint for GHC 9.6+ MkSolo support+* Remove GHC 9.4.8 support (requires older dependency versions)++0.4.0++* Comprehensive type class coverage across ecosystem packages+* Full lens integration with indexed operations+* Safe alternatives to partial functions+* Performance optimizations with INLINE pragmas+ 0.3.1 * Remove doctests test target and setup
papa.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: papa-version: 0.4.0+version: 0.5.0 license: BSD-3-Clause license-file: LICENCE author: Tony Morris <ʇǝu˙sıɹɹoɯʇ@ןןǝʞsɐɥ> <dibblego>@@ -97,14 +97,13 @@ bug-reports: https://gitlab.com/system-f/code/papa/issues build-type: Simple extra-doc-files: changelog.md-tested-with: GHC == 9.0.2- , GHC == 9.2.8- , GHC == 9.4.8- , GHC == 9.6.7+tested-with: GHC == 9.6.7 , GHC == 9.8.4 , GHC == 9.10.1- , GHC == 9.12.1- , GHC == 9.14.1+ , GHC == 9.12.4+ -- GHC 9.0-9.4 require older versions of dependencies:+ -- one < 0.0.4, associative < 0.0.4, id < 0.0.3+ -- (liftA2 and MkSolo compatibility issues) flag dev description: Enable development warnings (-Werror)@@ -132,9 +131,8 @@ , free >= 5 && < 6 , id >= 0 && < 1 , lens >= 4 && < 6- , lens-indexed-plated >= 0 && < 1 , mtl >= 2 && < 3- , one >= 0 && < 1+ , one >= 0.0.4 && < 1 , polytree >= 0 && < 1 , profunctors >= 5 && < 6 , selective >= 0 && < 1@@ -227,8 +225,6 @@ Papa.Lens Papa.Lens.Data.List Papa.Lens.Data.Tuple- Papa.LensIndexedPlated- Papa.LensIndexedPlated.Control.Lens.IndexedPlated Papa.One Papa.One.Control.One Papa.One.Renamed
src/Papa.hs view
@@ -1,5 +1,5 @@-{-# OPTIONS_GHC -Wall #-} {-# LANGUAGE NoImplicitPrelude #-}+{-# OPTIONS_GHC -Wall #-} -- | Papa prelude - a curated Haskell prelude --@@ -83,7 +83,6 @@ module Papa.Comonad.Control.Comonad.Env, module Papa.Comonad.Control.Comonad.Store, module Papa.Lens,- module Papa.LensIndexedPlated.Control.Lens.IndexedPlated, module Papa.Semigroupoids, ) where @@ -93,5 +92,4 @@ import Papa.Comonad.Control.Comonad.Env import Papa.Comonad.Control.Comonad.Store import Papa.Lens-import Papa.LensIndexedPlated.Control.Lens.IndexedPlated import Papa.Semigroupoids
src/Papa/Adjunctions.hs view
@@ -1,5 +1,5 @@-{-# OPTIONS_GHC -Wall #-} {-# LANGUAGE NoImplicitPrelude #-}+{-# OPTIONS_GHC -Wall #-} module Papa.Adjunctions ( module Papa.Adjunctions.Data.Functor.Adjunction,
src/Papa/Adjunctions/Renamed.hs view
@@ -1,5 +1,5 @@-{-# OPTIONS_GHC -Wall #-} {-# LANGUAGE NoImplicitPrelude #-}+{-# OPTIONS_GHC -Wall #-} -- | Re-exports from Papa.Adjunctions with conflicting identifiers hidden. --
src/Papa/Associative.hs view
@@ -1,5 +1,5 @@-{-# OPTIONS_GHC -Wall #-} {-# LANGUAGE NoImplicitPrelude #-}+{-# OPTIONS_GHC -Wall #-} module Papa.Associative ( module Papa.Associative.Data.Associative,
src/Papa/Associative/Renamed.hs view
@@ -1,5 +1,5 @@-{-# OPTIONS_GHC -Wall #-} {-# LANGUAGE NoImplicitPrelude #-}+{-# OPTIONS_GHC -Wall #-} -- | Re-exports from Papa.Associative with conflicting identifiers hidden. --
src/Papa/Base.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE NoImplicitPrelude #-} {-# OPTIONS_GHC -Wall #-} @@ -10,7 +11,6 @@ -- Import them directly if needed: -- > import Papa.Base.Control.Arrow -- > import Papa.Base.Control.Monad.Reader--- module Papa.Base ( module Papa.Base.Control.Applicative, module Papa.Base.Control.Category,@@ -53,7 +53,13 @@ import Papa.Base.Data.Function import Papa.Base.Data.Functor import Papa.Base.Data.Int++-- Hide uncons/unsnoc on GHC 9.8+ to avoid conflicts with Control.Lens.Cons+#if MIN_VERSION_base(4,19,0)+import Papa.Base.Data.List hiding (uncons, unsnoc)+#else import Papa.Base.Data.List+#endif import Papa.Base.Data.List.NonEmpty import Papa.Base.Data.Maybe import Papa.Base.Data.Monoid
src/Papa/Base/Control/Arrow.hs view
@@ -6,7 +6,7 @@ ) where import Control.Arrow as P (- Arrow (arr, first, second, (***), (&&&)),+ Arrow (arr, first, second, (&&&), (***)), ArrowApply (app), ArrowChoice (left, right, (+++), (|||)), ArrowLoop (loop),
src/Papa/Base/Control/Monad.hs view
@@ -48,7 +48,7 @@ MonadFix (mfix), ) import Control.Monad.Zip as P (- MonadZip (mzip, mzipWith, munzip),+ MonadZip (munzip, mzip, mzipWith), ) import Data.Bool (Bool (False, True))@@ -85,6 +85,7 @@ else return False {-# INLINE findM #-}+ -- | Find an element satisfying a predicate findM :: (Monad m) =>
src/Papa/Base/Data/Either.hs view
@@ -10,22 +10,22 @@ fromRight, ) where -import Control.Applicative ( Applicative(pure) )-import Control.Category ( Category((.), id) )-import Control.Lens ( _Left, _Right, Traversal )+import Control.Applicative (Applicative (pure))+import Control.Category (Category (id, (.)))+import Control.Lens (Traversal, _Left, _Right) import Data.Either as P ( Either (Left, Right), either, partitionEithers, )-import Data.Traversable ( Traversable(traverse) )+import Data.Traversable (Traversable (traverse)) {-# INLINE lefts #-}-lefts :: Traversable f => Traversal (f (Either a b)) (f (Either a' b)) a a'+lefts :: (Traversable f) => Traversal (f (Either a b)) (f (Either a' b)) a a' lefts = traverse . _Left {-# INLINE rights #-}-rights :: Traversable f => Traversal (f (Either a b)) (f (Either a b')) b b'+rights :: (Traversable f) => Traversal (f (Either a b)) (f (Either a b')) b b' rights = traverse . _Right {-# INLINE fromLeft #-}
src/Papa/Base/Data/Foldable.hs view
@@ -29,6 +29,7 @@ import Data.Foldable () {-# INLINE mapM_ #-}+ -- | Map each element to an action, evaluate these actions left to right, and ignore the results. -- -- >>> import Data.Maybe (Maybe(..))@@ -45,6 +46,7 @@ traverse_ {-# INLINE forM_ #-}+ -- | 'forM_' is 'mapM_' with its arguments flipped. -- -- >>> import Data.Maybe (Maybe(..))@@ -59,6 +61,7 @@ mapM_ f a {-# INLINE sequence_ #-}+ -- | Evaluate each action in the structure left to right, and ignore the results. -- -- >>> import Data.Maybe (Maybe(..))
src/Papa/Base/Data/Function.hs view
@@ -16,6 +16,7 @@ import Data.Functor (Functor (fmap)) {-# INLINE flip #-}+ -- | Apply a functorial function to a value. -- -- >>> import Data.Maybe (Maybe(..))
src/Papa/Base/Data/Functor.hs view
@@ -1,5 +1,5 @@-{-# LANGUAGE CPP #-} {-# LANGUAGE NoImplicitPrelude #-}+{-# LANGUAGE CPP #-} {-# OPTIONS_GHC -Wall #-} module Papa.Base.Data.Functor (@@ -18,6 +18,7 @@ ) {-# INLINE map #-}+ -- | Map a function over a functor. -- -- >>> map (\x -> x) [1,2,3]
src/Papa/Base/Data/List.hs view
@@ -1,5 +1,5 @@-{-# LANGUAGE CPP #-} {-# LANGUAGE NoImplicitPrelude #-}+{-# LANGUAGE CPP #-} {-# OPTIONS_GHC -Wall #-} module Papa.Base.Data.List (@@ -84,10 +84,11 @@ import Data.Maybe (Maybe (Just, Nothing)) import Data.Semigroup (Semigroup ((<>))) +{-# INLINE lookup #-}+ -- | Look up a key in an association list. -- -- >>> import Data.Maybe (Maybe(..))-{-# INLINE lookup #-} -- >>> lookup 2 [(1,'a'), (2,'b'), (3,'c')] -- Just 'b' -- >>> lookup 4 [(1,'a'), (2,'b'), (3,'c')]@@ -100,17 +101,18 @@ lookup a = foldr (\(x, y) b -> if x == a then Just y else b) Nothing +{-# SPECIALIZE (++) ::+ [a] ->+ [a] ->+ [a]+ #-}+ -- | Append two semigroups. -- -- >>> [1,2] ++ [3,4] -- [1,2,3,4] -- >>> "hello" ++ " world" -- "hello world"-{-# SPECIALIZE (++) ::- [a] ->- [a] ->- [a]- #-} (++) :: (Semigroup a) => a ->
src/Papa/Base/Data/List/NonEmpty.hs view
@@ -1,5 +1,6 @@ {-# LANGUAGE NoImplicitPrelude #-} {-# OPTIONS_GHC -Wall #-}+ {- HLINT ignore "Avoid restricted function" -} module Papa.Base.Data.List.NonEmpty (@@ -10,10 +11,8 @@ init, ) where -import Control.Lens ( Lens' )-import Data.Functor ( Functor(fmap) )-import Data.Semigroup ((<>))-import qualified Data.List.NonEmpty as NE+import Control.Lens (Lens')+import Data.Functor (Functor (fmap)) import Data.List.NonEmpty as P ( NonEmpty ((:|)), group,@@ -38,6 +37,8 @@ unfold, xor, )+import qualified Data.List.NonEmpty as NE+import Data.Semigroup ((<>)) -- | Lens to the head (first element) of a 'NonEmpty' list. --@@ -101,6 +102,6 @@ {-# INLINE init #-} init :: Lens' (NonEmpty a) [a] init f ne = fmap rebuild (f (NE.init ne))- where- rebuild [] = NE.last ne :| []- rebuild (x : xs) = x :| (xs <> [NE.last ne])+ where+ rebuild [] = NE.last ne :| []+ rebuild (x : xs) = x :| (xs <> [NE.last ne])
src/Papa/Base/Data/Monoid.hs view
@@ -13,6 +13,7 @@ import Data.Foldable (Foldable, fold) {-# INLINE mconcat #-}+ -- | Fold a list using the monoid. -- -- >>> mconcat [[1,2], [3,4], [5,6]]
src/Papa/Base/Data/Ord.hs view
@@ -6,12 +6,12 @@ module Q, ) where +import Data.Functor.Classes as Q (+ Ord1 (liftCompare),+ Ord2 (liftCompare2),+ ) import Data.Ord as P ( Down (Down), Ord (compare, max, min, (<), (<=), (>), (>=)), comparing,- )-import Data.Functor.Classes as Q (- Ord1 (liftCompare),- Ord2 (liftCompare2), )
src/Papa/Base/Data/Show.hs view
@@ -13,6 +13,6 @@ import Prelude as P ( Show (show, showsPrec), ShowS,- shows, showString,+ shows, )
src/Papa/Base/Data/Traversable.hs view
@@ -19,6 +19,7 @@ import Control.Applicative (Applicative) {-# INLINE mapM #-}+ -- | Map each element to an action, evaluate these actions left to right, and collect the results. -- -- >>> import Data.Maybe (Maybe(..))@@ -35,6 +36,7 @@ traverse {-# INLINE forM #-}+ -- | 'forM' is 'mapM' with its arguments flipped. -- -- >>> import Data.Maybe (Maybe(..))@@ -49,6 +51,7 @@ traverse f a {-# INLINE sequence #-}+ -- | Evaluate each action in the structure left to right, and collect the results. -- -- >>> import Data.Maybe (Maybe(..))
src/Papa/Bifunctors/Data/Bifoldable.hs view
@@ -10,6 +10,7 @@ import Data.Monoid (Monoid) {-# INLINE biconcat #-}+ -- | Fold a bifunctor containing monoids. -- -- >>> biconcat ([1,2], [3,4])@@ -24,6 +25,7 @@ bifold {-# INLINE biconcatMap #-}+ -- | Map each side of a bifunctor to a monoid and combine. -- -- >>> biconcatMap (\x -> [x]) (\x -> [x]) (1, 2)
src/Papa/Comonad.hs view
@@ -1,5 +1,5 @@-{-# OPTIONS_GHC -Wall #-} {-# LANGUAGE NoImplicitPrelude #-}+{-# OPTIONS_GHC -Wall #-} module Papa.Comonad ( module Papa.Comonad.Control.Comonad,
src/Papa/Comonad/Renamed.hs view
@@ -1,5 +1,5 @@-{-# OPTIONS_GHC -Wall #-} {-# LANGUAGE NoImplicitPrelude #-}+{-# OPTIONS_GHC -Wall #-} -- | Re-exports from Papa.Comonad. --
src/Papa/Containers.hs view
@@ -1,5 +1,5 @@-{-# OPTIONS_GHC -Wall #-} {-# LANGUAGE NoImplicitPrelude #-}+{-# OPTIONS_GHC -Wall #-} -- | This module cannot re-export all submodules due to name conflicts. -- Import the specific container types qualified instead:@@ -10,7 +10,6 @@ -- > import qualified Papa.Containers.Data.IntSet as IntSet -- > import qualified Papa.Containers.Data.Seq as Seq -- > import qualified Papa.Containers.Data.Tree as Tree--- module Papa.Containers () where -- Intentionally empty due to name conflicts between Map, IntMap, Set, IntSet, etc.
src/Papa/Free.hs view
@@ -1,5 +1,5 @@-{-# OPTIONS_GHC -Wall #-} {-# LANGUAGE NoImplicitPrelude #-}+{-# OPTIONS_GHC -Wall #-} -- | This module cannot re-export all submodules due to name conflicts. -- Import the specific Free types qualified instead:@@ -7,7 +7,6 @@ -- > import qualified Papa.Free.Control.Monad.Free as Free -- > import qualified Papa.Free.Control.Applicative.Free as FreeAp -- > import qualified Papa.Free.Control.Comonad.Cofree as Cofree--- module Papa.Free () where -- Intentionally empty due to name conflicts (Pure constructor in both Free and FreeAp)
src/Papa/Id.hs view
@@ -1,12 +1,11 @@-{-# OPTIONS_GHC -Wall #-} {-# LANGUAGE NoImplicitPrelude #-}+{-# OPTIONS_GHC -Wall #-} -- | This module cannot re-export all submodules due to name conflicts. -- Import the specific Id types qualified instead: -- -- > import qualified Papa.Id.Data.Id as Id -- > import qualified Papa.Id.Data.BiId as BiId--- module Papa.Id () where -- Intentionally empty due to name conflicts between Id and BiId (__Wrapped)
src/Papa/Lens/Data/List.hs view
@@ -1,5 +1,6 @@ {-# LANGUAGE NoImplicitPrelude #-} {-# OPTIONS_GHC -Wall #-}+ {- HLINT ignore "Avoid restricted function" -} module Papa.Lens.Data.List (
− src/Papa/LensIndexedPlated.hs
@@ -1,8 +0,0 @@-{-# OPTIONS_GHC -Wall #-}-{-# LANGUAGE NoImplicitPrelude #-}--module Papa.LensIndexedPlated (- module Papa.LensIndexedPlated.Control.Lens.IndexedPlated,-) where--import Papa.LensIndexedPlated.Control.Lens.IndexedPlated
− src/Papa/LensIndexedPlated/Control/Lens/IndexedPlated.hs
@@ -1,8 +0,0 @@-{-# LANGUAGE NoImplicitPrelude #-}-{-# OPTIONS_GHC -Wall #-}--module Papa.LensIndexedPlated.Control.Lens.IndexedPlated (- module X,-) where--import Control.Lens.IndexedPlated as X
src/Papa/One.hs view
@@ -1,5 +1,5 @@-{-# OPTIONS_GHC -Wall #-} {-# LANGUAGE NoImplicitPrelude #-}+{-# OPTIONS_GHC -Wall #-} module Papa.One ( module Papa.One.Control.One,
src/Papa/One/Renamed.hs view
@@ -1,5 +1,5 @@-{-# OPTIONS_GHC -Wall #-} {-# LANGUAGE NoImplicitPrelude #-}+{-# OPTIONS_GHC -Wall #-} -- | Re-exports from Papa.One with conflicting identifiers hidden. --
src/Papa/Polytree.hs view
@@ -1,5 +1,5 @@-{-# OPTIONS_GHC -Wall #-} {-# LANGUAGE NoImplicitPrelude #-}+{-# OPTIONS_GHC -Wall #-} module Papa.Polytree ( module Papa.Polytree.Data.Polytree,
src/Papa/Polytree/Renamed.hs view
@@ -1,5 +1,5 @@-{-# OPTIONS_GHC -Wall #-} {-# LANGUAGE NoImplicitPrelude #-}+{-# OPTIONS_GHC -Wall #-} -- | Re-exports from Papa.Polytree with renamed conflicting identifiers. --@@ -10,9 +10,10 @@ module Papa.Polytree.Data.Polytree, -- * Note on conflicts- -- The 'levels' function from Data.PolyTree conflicts with Control.Lens.Level.levels- -- Use 'Data.PolyTree.levels' directly when needed, or import qualified:- -- > import qualified Data.PolyTree as Tree ) where++-- The 'levels' function from Data.PolyTree conflicts with Control.Lens.Level.levels+-- Use 'Data.PolyTree.levels' directly when needed, or import qualified:+-- > import qualified Data.PolyTree as Tree import Papa.Polytree.Data.Polytree hiding (levels)
src/Papa/Profunctors.hs view
@@ -1,5 +1,5 @@-{-# OPTIONS_GHC -Wall #-} {-# LANGUAGE NoImplicitPrelude #-}+{-# OPTIONS_GHC -Wall #-} module Papa.Profunctors ( module Papa.Profunctors.Data.Profunctor,
src/Papa/Profunctors/Renamed.hs view
@@ -1,5 +1,5 @@-{-# OPTIONS_GHC -Wall #-} {-# LANGUAGE NoImplicitPrelude #-}+{-# OPTIONS_GHC -Wall #-} -- | Re-exports from Papa.Profunctors with conflicting identifiers hidden. --
src/Papa/Selective.hs view
@@ -1,5 +1,5 @@-{-# OPTIONS_GHC -Wall #-} {-# LANGUAGE NoImplicitPrelude #-}+{-# OPTIONS_GHC -Wall #-} module Papa.Selective ( module Papa.Selective.Control.Selective,
src/Papa/Selective/Renamed.hs view
@@ -1,5 +1,5 @@-{-# OPTIONS_GHC -Wall #-} {-# LANGUAGE NoImplicitPrelude #-}+{-# OPTIONS_GHC -Wall #-} -- | Re-exports from Papa.Selective with conflicting identifiers hidden. --
src/Papa/Semigroupoids/Data/Functor/Bind.hs view
@@ -9,6 +9,7 @@ import Data.Functor.Bind (Bind (join), (-<<)) {-# INLINE concat #-}+ -- | Flatten a nested structure. -- -- >>> concat [[1,2], [3,4], [5,6]]@@ -24,6 +25,7 @@ join {-# INLINE concatMap #-}+ -- | Map a function over a structure and flatten. -- -- >>> concatMap (\x -> [x, x]) [1,2,3]
src/Papa/Semigroupoids/Data/Semigroup/Foldable.hs view
@@ -12,6 +12,7 @@ import Data.Semigroup.Foldable {-# INLINE maximum #-}+ -- | Find the maximum element in a non-empty structure. -- -- >>> import Data.List.NonEmpty (NonEmpty(..))@@ -27,6 +28,7 @@ getMax . foldMap1 Max {-# INLINE minimum #-}+ -- | Find the minimum element in a non-empty structure. -- -- >>> import Data.List.NonEmpty (NonEmpty(..))
src/Papa/Witherable.hs view
@@ -1,5 +1,5 @@-{-# OPTIONS_GHC -Wall #-} {-# LANGUAGE NoImplicitPrelude #-}+{-# OPTIONS_GHC -Wall #-} module Papa.Witherable ( module Papa.Witherable.Witherable,
src/Papa/Witherable/Renamed.hs view
@@ -1,5 +1,5 @@-{-# OPTIONS_GHC -Wall #-} {-# LANGUAGE NoImplicitPrelude #-}+{-# OPTIONS_GHC -Wall #-} -- | Re-exports from Papa.Witherable with conflicting identifiers hidden. --
test/Main.hs view
@@ -1,6 +1,9 @@ {-# LANGUAGE NoImplicitPrelude #-} {-# OPTIONS_GHC -Wall #-} +{- HLINT ignore "Avoid restricted function" -}+{- HLINT ignore "Evaluate" -}+ module Main where import Papa