composition-prelude 0.1.0.0 → 0.1.0.1
raw patch · 2 files changed
+8/−9 lines, 2 files
Files
composition-prelude.cabal view
@@ -1,5 +1,5 @@ name: composition-prelude-version: 0.1.0.0+version: 0.1.0.1 synopsis: Higher-order function combinators description: Replacement for `composition` or `composition-exta`, exporting everything in one sane module. homepage: https://github.com/vmchale/composition-prelude#readme
src/Control/Composition.hs view
@@ -2,6 +2,7 @@ ( -- ^ Postcomposition (.*) , (.**)+ , (.***) -- ^ Precomposition , (-.) , (-.*)@@ -19,33 +20,31 @@ , (&) , fix , on+ , ap ) where import Control.Arrow ((&&&), (***))-import Control.Monad (join, (<=<), (=<<), (>=>))+import Control.Monad (ap, join, (<=<), (=<<), (>=>)) import Data.Function (fix, on, (&)) infixr 8 .* infixr 8 -.* -{-weird' :: (b -> (c -> d)) -> (a -> (c -> b)) -> (a -> (c -> d))-weird' = (<=<)--weird :: (a -> (b -> c)) -> (b -> a) -> (b -> c)-weird = (=<<)-}- both :: (a -> b) -> (a, a) -> (b, b) both = join (***) -- | As an example: -- -- > λ:> ((*2) .* (+)) 1 3 4--- > 4+-- > 16 (.*) :: (c -> d) -> (a -> b -> c) -> a -> b -> d (.*) f g x y = f (g x y) (.**) :: (d -> e) -> (a -> b -> c -> d) -> a -> b -> c -> e (.**) f g x y z = f (g x y z)++(.***) :: (e -> f) -> (a -> b -> c -> d -> e) -> a -> b -> c -> d -> f+(.***) f g w x y z = f (g w x y z) -- | The Oedipus combinator (-.*) :: (b -> c) -> (a -> c -> d) -> a -> b -> d