basic-prelude 0.4.1 → 0.5.0
raw patch · 4 files changed
+56/−7 lines, 4 filesdep ~basePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base
API changes (from Hackage documentation)
+ BasicPrelude: class Foldable (t :: * -> *)
+ BasicPrelude: class (Functor t, Foldable t) => Traversable (t :: * -> *)
+ BasicPrelude: elem :: (Foldable t, Eq a) => a -> t a -> Bool
+ BasicPrelude: foldMap :: (Foldable t, Monoid m) => (a -> m) -> t a -> m
+ BasicPrelude: foldl :: Foldable t => (b -> a -> b) -> b -> t a -> b
+ BasicPrelude: foldl' :: Foldable t => (b -> a -> b) -> b -> t a -> b
+ BasicPrelude: foldl1 :: Foldable t => (a -> a -> a) -> t a -> a
+ BasicPrelude: foldr :: Foldable t => (a -> b -> b) -> b -> t a -> b
+ BasicPrelude: foldr' :: Foldable t => (a -> b -> b) -> b -> t a -> b
+ BasicPrelude: foldr1 :: Foldable t => (a -> a -> a) -> t a -> a
+ BasicPrelude: mapM :: (Traversable t, Monad m) => (a -> m b) -> t a -> m (t b)
+ BasicPrelude: maximum :: (Foldable t, Ord a) => t a -> a
+ BasicPrelude: minimum :: (Foldable t, Ord a) => t a -> a
+ BasicPrelude: sequence :: (Traversable t, Monad m) => t (m a) -> m (t a)
+ BasicPrelude: sequenceA :: (Traversable t, Applicative f) => t (f a) -> f (t a)
+ BasicPrelude: traverse :: (Traversable t, Applicative f) => (a -> f b) -> t a -> f (t b)
+ CorePrelude: class Foldable (t :: * -> *)
+ CorePrelude: class (Functor t, Foldable t) => Traversable (t :: * -> *)
Files
- BasicPrelude.hs +44/−5
- ChangeLog.md +4/−0
- CorePrelude.hs +7/−1
- basic-prelude.cabal +1/−1
BasicPrelude.hs view
@@ -13,6 +13,29 @@ , module Data.List , module Control.Monad + -- ** Folds and traversals+ , Foldable+ (+ foldMap+ , foldr+ , foldr'+ , foldl+ , foldl'+ , foldr1+ , foldl1+ )+ -- In base-4.8, these are instance methods.+ , elem+ , maximum+ , minimum+ , Traversable+ (+ traverse+ , sequenceA+ , mapM+ , sequence+ )+ -- * Enhanced exports -- ** Simpler name for a typeclassed operation , map@@ -21,8 +44,8 @@ , concat , intercalate -- ** Strict implementation- , sum- , product+ , BasicPrelude.sum+ , BasicPrelude.product -- ** Text for Read and Show operations , show , fromShow@@ -93,14 +116,30 @@ -- prefer strict versions , sum , product+ -- prefer Foldable versions+ , elem+ , foldl+ , foldl'+ , foldl1+ , foldr+ , foldr'+ , foldr1+ , maximum+ , minimum ) -- Import *all of the things* from Control.Monad, -- specifically, the list-based things that -- CorePrelude doesn't export-import Control.Monad+import Control.Monad hiding+ ( -- Also exported by Data.Traversable.+ mapM+ , sequence+ ) +import Data.Foldable (Foldable(..), elem, maximum, minimum)+import Data.Traversable (Traversable(..)) import qualified Data.Text as Text import qualified Data.Text.IO as Text import qualified Data.Text.Lazy as LText@@ -135,11 +174,11 @@ -- | Compute the sum of a finite list of numbers. sum :: Num a => [a] -> a-sum = foldl' (+) 0+sum = Data.Foldable.foldl' (+) 0 -- | Compute the product of a finite list of numbers. product :: Num a => [a] -> a-product = foldl' (*) 1+product = Data.Foldable.foldl' (*) 1 -- | Convert a value to readable Text
ChangeLog.md view
@@ -1,3 +1,7 @@+## 0.5.0++* Expose more Foldable/Traversable stuff+ ## 0.4.1 * terror
CorePrelude.hs view
@@ -101,7 +101,10 @@ -- ** Monoids , Monoid (..) , (<>)- -- ** Arrow+ -- ** Folds and traversals+ , Data.Foldable.Foldable+ , Data.Traversable.Traversable+ -- ** arrow , Control.Arrow.first , Control.Arrow.second , (Control.Arrow.***)@@ -182,6 +185,9 @@ import qualified Control.Exception import qualified Control.Exception.Lifted import qualified Data.Typeable++import qualified Data.Foldable+import qualified Data.Traversable import Data.Word (Word8, Word32, Word64, Word) import Data.Int (Int32, Int64)
basic-prelude.cabal view
@@ -1,5 +1,5 @@ name: basic-prelude-version: 0.4.1+version: 0.5.0 synopsis: An enhanced core prelude; a common foundation for alternate preludes. description: The premise of @basic-prelude@ is that there are a lot of very commonly desired features missing from the standard @Prelude@, such as commonly used operators (@\<$\>@ and @>=>@, for instance) and imports for common datatypes (e.g., @ByteString@ and @Vector@). At the same time, there are lots of other components which are more debatable, such as providing polymorphic versions of common functions.