Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- class Commutative a where
- commute :: a -> a -> a
- (<~>) :: Commutative a => a -> a -> a
- class Commutative a => CommutativeId a where
- cempty :: a
- commuteVia :: Bool -> (a -> a -> a) -> a -> a -> a
- commuteViaF :: Functor f => f Bool -> (a -> a -> a) -> a -> a -> f a
- newtype CommEndo a = CommEndo {
- appCommEndo :: a -> a
- newtype OneOf a = OneOf {}
- pick1 :: a -> a -> a
Documentation
class Commutative a where Source #
Instances
Commutative () Source # | |
Defined in Data.Commutative | |
Commutative All Source # | |
Commutative Any Source # | |
Num a => Commutative (Sum a) Source # | |
Num a => Commutative (Product a) Source # | |
Commutative (OneOf a) Source # | |
Commutative (CommEndo a) Source # | |
(<~>) :: Commutative a => a -> a -> a Source #
class Commutative a => CommutativeId a where Source #
Instances
CommutativeId () Source # | |
Defined in Data.Commutative | |
CommutativeId All Source # | |
Defined in Data.Commutative | |
CommutativeId Any Source # | |
Defined in Data.Commutative | |
Num a => CommutativeId (Sum a) Source # | |
Defined in Data.Commutative | |
Num a => CommutativeId (Product a) Source # | |
Defined in Data.Commutative | |
CommutativeId (OneOf a) Source # | |
Defined in Data.Commutative | |
CommutativeId (CommEndo a) Source # | |
Defined in Data.Commutative |
commuteVia :: Bool -> (a -> a -> a) -> a -> a -> a Source #
flip
when False
- simple & pure "predicative" commute.
commuteViaF :: Functor f => f Bool -> (a -> a -> a) -> a -> a -> f a Source #
Lifted predicative behaviour.
Endomorphisms commutative over composition.
Warning: The Commutative
instance uses unsafePerformIO
to randomly pick the order.
CommEndo | |
|
Instances
CommutativeId (CommEndo a) Source # | |
Defined in Data.Commutative | |
Commutative (CommEndo a) Source # | |
In the case of two Just
values, the commutative instance randomly chooses one of them.
Warning: The Commutative
instance uses unsafePerformIO
to randomly pick the order.