Popularity
4.4
Declining
Activity
0.0
Stable
8
2
1
Monthly Downloads: 15
Programming language: Haskell
License: BSD 3-clause "New" or "Revised" License
Latest version: v1.0.1.0
composition-extra alternatives and similar packages
Based on the "Composition" category.
Alternatively, view composition-extra alternatives based on common mentions on social networks and blogs.
-
composition-tree
Composition trees for arbitrary monoids. -
composition
Combinators for unorthodox function composition in Haskell -
invertible
Haskell bidirectional arrows, bijective functions, and invariant functors -
Aoide
A simple music library with the capability of generating .ly and .mid files.
Less time debugging, more time building
Scout APM allows you to find and fix performance issues with no hassle. Now with error monitoring and external services monitoring, Scout is a developer's best friend when it comes to application development.
Promo
scoutapm.com
Do you think we are missing an alternative of composition-extra or a related project?
README
composition-extra
Some handy tools for working with algebraic structures.
Functors
We can fmap
more deeply with Applicative-style syntax:
(+1) <$$> [Just 1, Nothing, Just 2]
> [Just 2, Nothing, Just 3]
Likewise, via contravariant functors:
:t (-2) <-$$$> (Predicate $ (==) Predicate $ (==) Predicate $ (==) 5)
> :: ( Eq b
, Eq (Predicate b)
, Eq (Predicate (Predicate b))
, Num b
, Num (a -> Predicate b)
, Contravariant ((->) (Predicate (Predicate b) -> Bool))
) => Predicate (Predicate a)
(it's not that useful)
Functions
You can slyly prepend unanry functions to arbitrary arguments (contravariant function compositon):
before :: [q] -> d
func2 :: c -> d -> e
func3 :: b -> c -> d -> e
func4 :: a -> b -> c -> d -> e
before -.* func2 :: c -> [q] -> e
before -.** func3 :: b -> c -> [q] -> e
before -.*** func4 :: a -> b -> c -> [q] -> e
Monads
We can also do weird liftM
-ish, applicative-y stuff, too:
import Data.Compositon -- from the `compositon` package
(return .: (+)) ==<< mx =<< my
mx >>==== (return .:: func4) -- apply to 4th arg