prelude-generalize 0.2 → 0.3
raw patch · 2 files changed
+15/−5 lines, 2 files
Files
- Prelude/Generalize.hs +14/−4
- prelude-generalize.cabal +1/−1
Prelude/Generalize.hs view
@@ -6,8 +6,8 @@ bool, (<>>=), (!!), tail, length, filter, consA, liftPair, Peanoid(..), Copeanoid(..), fair, (++), module Data.Functor.Identity, iterate, church, unfoldr, convList, head, drop, take, find, takeWhile, dropWhile, tails, - findIndex, module Control.Category, ($), module Control.Arrow, option, - cycle, mcycle, repeat, replicate, module Data.Traversable, count, choice, + findIndex, module Control.Category, module Control.Arrow, option, cycle, + mcycle, repeat, replicate, module Data.Traversable, count, choice, mreplicate, (>>==), groupBy, lefts, rights, partitionEithers, null, concat, module Data.Bits, module Data.Int, module Data.Word, Swap(..), Peano, atLeast, (.:), (.::), (.:::), bind2, bind3, (!!!), transEnum, transInt, @@ -20,7 +20,7 @@ nubBy, deleteF, delete, group, insert, insertBy, intersect, intersectBy, partition, permutations, subsequences, transpose, union, unionBy, unzip4, unzip5, unzip6, unzip7, zip4, zip5, zip6, zip7, zipWith4, zipWith5, - zipWith6, zipWith7 + zipWith6, zipWith7, lcomp, rcomp, loeb, Function(..) ) where { import Prelude hiding (head, tail, (!!), foldr, foldl, length, filter, mapM_, @@ -576,7 +576,7 @@ unnull :: Foldable t => t x -> Bool; unnull = foldr (\_ _ -> True) False; {-# RULES "L.unnull" unnull = not . L.null #-}; -{-# RULES "M.unnull" null = M.isJust #-}; +{-# RULES "M.unnull" unnull = M.isJust #-}; concat :: (MonadPlus m, Foldable f) => m (f x) -> m x; concat = (>>= foldr (mplus . return) mzero); @@ -706,5 +706,15 @@ stripPrefixBy _ [] y = Just y; stripPrefixBy f (x : xs) (y : ys) | f x y = stripPrefixBy f xs ys; stripPrefixBy _ _ _ = Nothing; + + lcomp :: (Foldable t, Category c) => t (c x x) -> c x x; + lcomp = foldl (<<<) id; + + rcomp :: (Foldable t, Category c) => t (c x x) -> c x x; + rcomp = foldr (>>>) id; + + loeb :: (Function a (f b) b, Functor f) => f a -> f b; + loeb x = ($ loeb x) <$> x; +{-# SPECIALIZE loeb :: Functor f => f (f x -> x) -> f x #-}; }
prelude-generalize.cabal view
@@ -7,7 +7,7 @@ -- The package version. See the Haskell package versioning policy -- (http://www.haskell.org/haskellwiki/Package_versioning_policy) for -- standards guiding when and how versions should be incremented. -Version: 0.2 +Version: 0.3 -- A short (one-line) description of the package. Synopsis: Another kind of alternate Prelude file