composition-prelude 1.5.0.8 → 1.5.1.0
raw patch · 3 files changed
+20/−15 lines, 3 filessetup-changedPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
+ Control.Composition: threadM :: (Monad m, Foldable t) => t (a -> m a) -> a -> m a
- Control.Composition: thread :: [a -> a] -> a -> a
+ Control.Composition: thread :: Foldable t => t (a -> a) -> a -> a
Files
- Setup.hs +0/−2
- composition-prelude.cabal +2/−1
- src/Control/Composition.hs +18/−12
− Setup.hs
@@ -1,2 +0,0 @@-import Distribution.Simple-main = defaultMain
composition-prelude.cabal view
@@ -1,11 +1,12 @@ cabal-version: 1.18 name: composition-prelude-version: 1.5.0.8+version: 1.5.1.0 license: BSD3 license-file: LICENSE copyright: Copyright: (c) 2017-2018 Vanessa McHale maintainer: vamchale@gmail.com author: Vanessa McHale+tested-with: ghc ==8.4.3 ghc ==8.6.1 bug-reports: https://hub.darcs.net/vmchale/composition-prelude/issues synopsis: Higher-order function combinators description:
src/Control/Composition.hs view
@@ -19,6 +19,7 @@ , biaxe -- * Composition with lists of functions , thread+ , threadM -- * Tuple helpers , both -- * Reëxports from base@@ -89,23 +90,28 @@ (-.****) :: (e -> f) -> (a -> b -> c -> d -> f -> g) -> a -> b -> c -> d -> e -> g (-.****) f g v w x y z = g v w x y (f z) --- | Backwards function composition+-- | Backwards function composition. This is a specialization of '<&>'. (-.) :: (a -> b) -> (b -> c) -> a -> c-(-.) f g x = g (f x)--{-# RULES- "thread" forall f g. thread [f, g] = f . g- #-}--{-# RULES- "thread" forall f g h. thread [f, g, h] = f . g . h- #-}+(-.) = (<&>) {-# RULES- "thread" forall f fs. thread (f:fs) = f . thread fs+ "thread" forall f g. thread [f, g] = f . g;+ "thread" forall f g h. thread [f, g, h] = f . g . h;+ "thread" forall f fs. thread (f:fs) = f . thread fs #-} -thread :: [a -> a] -> a -> a+thread :: Foldable t => t (a -> a) -> a -> a thread = foldr (.) id {-# INLINE [1] thread #-}++threadM :: (Monad m, Foldable t) => t (a -> m a) -> a -> m a+threadM = foldr (<=<) pure++{-# INLINE [1] threadM #-}++{-# RULES+ "threadM" forall f g. threadM [f, g] = f <=< g;+ "threadM" forall f g h. threadM [f, g, h] = f <=< g <=< h;+ "threadM" forall f fs. threadM (f:fs) = f <=< threadM fs+ #-}