| Safe Haskell | Safe |
|---|---|
| Language | Haskell2010 |
Papa.Semigroupoids.Export
- class Bifunctor p where
- class Bifunctor p => Biapply p where
- (<<$>>) :: (a -> b) -> a -> b
- (<<..>>) :: Biapply p => p a c -> p (a -> b) (c -> d) -> p b d
- bilift2 :: Biapply w => (a -> b -> c) -> (d -> e -> f) -> w a d -> w b e -> w c f
- bilift3 :: Biapply w => (a -> b -> c -> d) -> (e -> f -> g -> h) -> w a e -> w b f -> w c g -> w d h
- class Functor f => Alt f where
- class Functor f => Apply f where
- (<..>) :: Apply w => w a -> w (a -> b) -> w b
- liftF2 :: Apply w => (a -> b -> c) -> w a -> w b -> w c
- liftF3 :: Apply w => (a -> b -> c -> d) -> w a -> w b -> w c -> w d
- data WrappedApplicative f a :: (* -> *) -> * -> *
- data MaybeApply f a :: (* -> *) -> * -> *
- class Apply m => Bind m where
- (-<<) :: Bind m => (a -> m b) -> m a -> m b
- (-<-) :: Bind m => (b -> m c) -> (a -> m b) -> a -> m c
- (->-) :: Bind m => (a -> m b) -> (b -> m c) -> a -> m c
- apDefault :: Bind f => f (a -> b) -> f a -> f b
- returning :: Functor f => f a -> (a -> b) -> f b
- class MonadTrans t => BindTrans t where
- class Functor w => Extend w where
- class Alt f => Plus f where
- class Semigroupoid k k1 => Groupoid k k1 where
- class Bifoldable t => Bifoldable1 t where
- bitraverse1_ :: (Bifoldable1 t, Apply f) => (a -> f b) -> (c -> f d) -> t a c -> f ()
- bifor1_ :: (Bifoldable1 t, Apply f) => t a c -> (a -> f b) -> (c -> f d) -> f ()
- bisequenceA1_ :: (Bifoldable1 t, Apply f) => t (f a) (f b) -> f ()
- bifoldMapDefault1 :: (Bifoldable1 t, Monoid m) => (a -> m) -> (b -> m) -> t a b -> m
- class (Bifoldable1 t, Bitraversable t) => Bitraversable1 t where
- bifoldMap1Default :: (Bitraversable1 t, Semigroup m) => (a -> m) -> (b -> m) -> t a b -> m
- class Foldable t => Foldable1 t where
- intercalate1 :: (Foldable1 t, Semigroup m) => m -> t m -> m
- intercalateMap1 :: (Foldable1 t, Semigroup m) => m -> (a -> m) -> t a -> m
- traverse1_ :: (Foldable1 t, Apply f) => (a -> f b) -> t a -> f ()
- for1_ :: (Foldable1 t, Apply f) => t a -> (a -> f b) -> f ()
- sequenceA1_ :: (Foldable1 t, Apply f) => t (f a) -> f ()
- foldMapDefault1 :: (Foldable1 t, Monoid m) => (a -> m) -> t a -> m
- asum1 :: (Foldable1 t, Alt m) => t (m a) -> m a
- class (Foldable1 t, Traversable t) => Traversable1 t where
- foldMap1Default :: (Traversable1 f, Semigroup m) => (a -> m) -> f a -> m
- class Semigroupoid k c where
- data WrappedCategory k k1 k2 a b :: forall k k1. (k1 -> k -> *) -> k1 -> k -> *
- data Semi k k1 m a b :: forall k k1. * -> k1 -> k -> *
- class Semigroupoid k k1 => Ob k k1 a where
- data Static f a b :: (* -> *) -> * -> * -> *
Documentation
Formally, the class Bifunctor represents a bifunctor
from Hask -> Hask.
Intuitively it is a bifunctor where both the first and second arguments are covariant.
You can define a Bifunctor by either defining bimap or by
defining both first and second.
If you supply bimap, you should ensure that:
bimapidid≡id
If you supply first and second, ensure:
firstid≡idsecondid≡id
If you supply both, you should also ensure:
bimapf g ≡firstf.secondg
These ensure by parametricity:
bimap(f.g) (h.i) ≡bimapf h.bimapg ifirst(f.g) ≡firstf.firstgsecond(f.g) ≡secondf.secondg
Since: 4.8.0.0
class Bifunctor p => Biapply p where #
Minimal complete definition
Methods
(<<.>>) :: p (a -> b) (c -> d) -> p a c -> p b d infixl 4 #
Instances
| Biapply (,) | |
| Biapply Arg | |
| Semigroup x => Biapply ((,,) x) | |
| Biapply (Const *) | |
| Biapply (Tagged *) | |
| (Semigroup x, Semigroup y) => Biapply ((,,,) x y) | |
| (Semigroup x, Semigroup y, Semigroup z) => Biapply ((,,,,) x y z) | |
| Biapply p => Biapply (WrappedBifunctor * * p) | |
| Apply g => Biapply (Joker * * g) | |
| Biapply p => Biapply (Flip * * p) | |
| Apply f => Biapply (Clown * * f) | |
| (Biapply p, Biapply q) => Biapply (Product * * p q) | |
| (Apply f, Biapply p) => Biapply (Tannen * * * f p) | |
| (Biapply p, Apply f, Apply g) => Biapply (Biff * * * * p f g) | |
bilift2 :: Biapply w => (a -> b -> c) -> (d -> e -> f) -> w a d -> w b e -> w c f #
Lift binary functions
bilift3 :: Biapply w => (a -> b -> c -> d) -> (e -> f -> g -> h) -> w a e -> w b f -> w c g -> w d h #
Lift ternary functions
class Functor f => Alt f where #
Laws:
<!> is associative: (a <!> b) <!> c = a <!> (b <!> c) <$> left-distributes over <!>: f <$> (a <!> b) = (f <$> a) <!> (f <$> b)
If extended to an Alternative then <!> should equal <|>.
Ideally, an instance of Alt also satisfies the "left distributon" law of
MonadPlus with respect to <.>:
<.> right-distributes over <!>: (a <!> b) <.> c = (a <.> c) <!> (b <.> c)
But Maybe, IO, , Either a, and ErrorT e mSTM satisfy the alternative
"left catch" law instead:
pure a <!> b = pure a
However, this variation cannot be stated purely in terms of the dependencies of Alt.
When and if MonadPlus is successfully refactored, this class should also be refactored to remove these instances.
The right distributive law should extend in the cases where the a Bind or Monad is
provided to yield variations of the right distributive law:
(m <!> n) >>- f = (m >>- f) <!> (m >>- f) (m <!> n) >>= f = (m >>= f) <!> (m >>= f)
Minimal complete definition
Instances
| Alt [] | |
| Alt Maybe | |
| Alt IO | This instance does not actually satisfy the ( |
| Alt V1 | |
| Alt U1 | |
| Alt Option | |
| Alt NonEmpty | |
| Alt IntMap | |
| Alt Seq | |
| Alt (Either a) | |
| Alt f => Alt (Rec1 f) | |
| MonadPlus m => Alt (WrappedMonad m) | |
| Alt (Proxy *) | |
| Ord k => Alt (Map k) | |
| Alternative f => Alt (WrappedApplicative f) | |
| Alt f => Alt (Lift f) | |
| (Bind f, Monad f) => Alt (MaybeT f) | |
| Apply f => Alt (ListT f) | |
| (Alt f, Alt g) => Alt ((:*:) f g) | |
| ArrowPlus a => Alt (WrappedArrow a b) | |
| Alt f => Alt (IdentityT * f) | |
| (Bind f, Monad f) => Alt (ErrorT e f) | |
| Alt f => Alt (Static f a) | |
| Alt f => Alt (Reverse * f) | |
| Alt f => Alt (Backwards * f) | |
| Alt f => Alt (WriterT w f) | |
| Alt f => Alt (WriterT w f) | |
| Alt f => Alt (StateT e f) | |
| Alt f => Alt (StateT e f) | |
| (Bind f, Monad f, Semigroup e) => Alt (ExceptT e f) | |
| Alt f => Alt (M1 i c f) | |
| (Alt f, Alt g) => Alt (Product * f g) | |
| Alt f => Alt (ReaderT * e f) | |
| (Alt f, Functor g) => Alt (Compose * * f g) | |
| Alt f => Alt (RWST r w s f) | |
| Alt f => Alt (RWST r w s f) | |
class Functor f => Apply f where #
A strong lax semi-monoidal endofunctor.
This is equivalent to an Applicative without pure.
Laws:
(.)<$>u<.>v<.>w = u<.>(v<.>w) x<.>(f<$>y) = (.f)<$>x<.>y f<$>(x<.>y) = (f.)<$>x<.>y
The laws imply that .> and <. really ignore their
left and right results, respectively, and really
return their right and left results, respectively.
Specifically,
(mf<$>m).>(nf<$>n) = nf<$>(m.>n) (mf<$>m)<.(nf<$>n) = mf<$>(m<.n)
Minimal complete definition
Instances
(<..>) :: Apply w => w a -> w (a -> b) -> w b infixl 4 #
A variant of <.> with the arguments reversed.
liftF2 :: Apply w => (a -> b -> c) -> w a -> w b -> w c #
Lift a binary function into a comonad with zipping
liftF3 :: Apply w => (a -> b -> c -> d) -> w a -> w b -> w c -> w d #
Lift a ternary function into a comonad with zipping
data WrappedApplicative f a :: (* -> *) -> * -> * #
Wrap an Applicative to be used as a member of Apply
Instances
| Functor f => Functor (WrappedApplicative f) | |
| Applicative f => Applicative (WrappedApplicative f) | |
| Alternative f => Alternative (WrappedApplicative f) | |
| Alternative f => Plus (WrappedApplicative f) | |
| Alternative f => Alt (WrappedApplicative f) | |
| Applicative f => Apply (WrappedApplicative f) | |
data MaybeApply f a :: (* -> *) -> * -> * #
Transform a Apply into an Applicative by adding a unit.
Instances
| Functor f => Functor (MaybeApply f) | |
| Apply f => Applicative (MaybeApply f) | |
| Comonad f => Comonad (MaybeApply f) | |
| Apply f => Apply (MaybeApply f) | |
| Extend f => Extend (MaybeApply f) | |
class Apply m => Bind m where #
Minimal definition: Either join or >>-
If defining both, then the following laws (the default definitions) must hold:
join = (>>- id) m >>- f = join (fmap f m)
Laws:
induced definition of <.>: f <.> x = f >>- (<$> x)
Finally, there are two associativity conditions:
associativity of (>>-): (m >>- f) >>- g == m >>- (\x -> f x >>- g) associativity of join: join . join = join . fmap join
These can both be seen as special cases of the constraint that
associativity of (->-): (f ->- g) ->- h = f ->- (g ->- h)
Instances
| Bind [] | |
| Bind Maybe | |
| Bind IO | |
| Bind Identity | |
| Bind Option | |
| Bind NonEmpty | |
| Bind Complex | |
| Bind IntMap | |
| Bind Tree | |
| Bind Seq | |
| Bind ((->) m) | |
| Bind (Either a) | |
| Semigroup m => Bind ((,) m) | |
| Monad m => Bind (WrappedMonad m) | |
| Bind (Proxy *) | |
| Ord k => Bind (Map k) | |
| (Hashable k, Eq k) => Bind (HashMap k) | |
| (Functor m, Monad m) => Bind (MaybeT m) | |
| (Apply m, Monad m) => Bind (ListT m) | |
| Bind m => Bind (IdentityT * m) | |
| (Functor m, Monad m) => Bind (ErrorT e m) | |
| Bind (Tagged * a) | |
| (Bind m, Semigroup w) => Bind (WriterT w m) | |
| (Bind m, Semigroup w) => Bind (WriterT w m) | |
| Bind m => Bind (StateT s m) | |
| Bind m => Bind (StateT s m) | |
| (Functor m, Monad m) => Bind (ExceptT e m) | |
| (Bind f, Bind g) => Bind (Product * f g) | |
| Bind m => Bind (ReaderT * e m) | |
| Bind (ContT * r m) | |
| (Bind m, Semigroup w) => Bind (RWST r w s m) | |
| (Bind m, Semigroup w) => Bind (RWST r w s m) | |
class MonadTrans t => BindTrans t where #
A subset of monad transformers can transform any Bind as well.
Minimal complete definition
class Functor w => Extend w where #
Minimal complete definition
Methods
duplicated :: w a -> w (w a) #
duplicated = extended id fmap (fmap f) . duplicated = duplicated . fmap f
extended :: (w a -> b) -> w a -> w b #
extended f = fmap f . duplicated
Instances
| Extend [] | |
| Extend Maybe | |
| Extend Identity | |
| Extend NonEmpty | |
| Extend Tree | |
| Extend Seq | |
| Semigroup m => Extend ((->) m) | |
| Extend (Either a) | |
| Extend ((,) e) | |
| Extend (Proxy *) | |
| Extend f => Extend (MaybeApply f) | |
| (Extend w, Semigroup m) => Extend (TracedT m w) | |
| Extend w => Extend (StoreT s w) | |
| Extend w => Extend (EnvT e w) | |
| Extend w => Extend (IdentityT * w) | |
| (Extend f, Semigroup a) => Extend (Static f a) | |
| Extend (Tagged * a) | |
| (Extend f, Extend g) => Extend (Sum * f g) | |
Minimal complete definition
Instances
| Plus [] | |
| Plus Maybe | |
| Plus IO | |
| Plus U1 | |
| Plus Option | |
| Plus IntMap | |
| Plus Seq | |
| Plus f => Plus (Rec1 f) | |
| MonadPlus m => Plus (WrappedMonad m) | |
| Plus (Proxy *) | |
| Ord k => Plus (Map k) | |
| Alternative f => Plus (WrappedApplicative f) | |
| Plus f => Plus (Lift f) | |
| (Bind f, Monad f) => Plus (MaybeT f) | |
| (Apply f, Applicative f) => Plus (ListT f) | |
| (Plus f, Plus g) => Plus ((:*:) f g) | |
| ArrowPlus a => Plus (WrappedArrow a b) | |
| Plus f => Plus (IdentityT * f) | |
| (Bind f, Monad f, Error e) => Plus (ErrorT e f) | |
| Plus f => Plus (Static f a) | |
| Plus f => Plus (Reverse * f) | |
| Plus f => Plus (Backwards * f) | |
| Plus f => Plus (WriterT w f) | |
| Plus f => Plus (WriterT w f) | |
| Plus f => Plus (StateT e f) | |
| Plus f => Plus (StateT e f) | |
| (Bind f, Monad f, Semigroup e, Monoid e) => Plus (ExceptT e f) | |
| Plus f => Plus (M1 i c f) | |
| (Plus f, Plus g) => Plus (Product * f g) | |
| Plus f => Plus (ReaderT * e f) | |
| (Plus f, Functor g) => Plus (Compose * * f g) | |
| Plus f => Plus (RWST r w s f) | |
| Plus f => Plus (RWST r w s f) | |
class Semigroupoid k k1 => Groupoid k k1 where #
semigroupoid with inverses. This technically should be a category with inverses, except we need to use Ob to define the valid objects for the category
Minimal complete definition
class Bifoldable t => Bifoldable1 t where #
Methods
bifold1 :: Semigroup m => t m m -> m #
bifoldMap1 :: Semigroup m => (a -> m) -> (b -> m) -> t a b -> m #
Instances
| Bifoldable1 Either | |
| Bifoldable1 (,) | |
| Bifoldable1 Arg | |
| Bifoldable1 ((,,) x) | |
| Bifoldable1 (Const *) | |
| Bifoldable1 (Tagged *) | |
| Bifoldable1 ((,,,) x y) | |
| Bifoldable1 ((,,,,) x y z) | |
| Bifoldable1 p => Bifoldable1 (WrappedBifunctor * * p) | |
| Foldable1 g => Bifoldable1 (Joker * * g) | |
| Bifoldable1 p => Bifoldable1 (Flip * * p) | |
| Foldable1 f => Bifoldable1 (Clown * * f) | |
| (Bifoldable1 f, Bifoldable1 g) => Bifoldable1 (Product * * f g) | |
| (Foldable1 f, Bifoldable1 p) => Bifoldable1 (Tannen * * * f p) | |
| (Bifoldable1 p, Foldable1 f, Foldable1 g) => Bifoldable1 (Biff * * * * p f g) | |
bitraverse1_ :: (Bifoldable1 t, Apply f) => (a -> f b) -> (c -> f d) -> t a c -> f () #
bifor1_ :: (Bifoldable1 t, Apply f) => t a c -> (a -> f b) -> (c -> f d) -> f () #
bisequenceA1_ :: (Bifoldable1 t, Apply f) => t (f a) (f b) -> f () #
bifoldMapDefault1 :: (Bifoldable1 t, Monoid m) => (a -> m) -> (b -> m) -> t a b -> m #
Usable default for foldMap, but only if you define bifoldMap1 yourself
class (Bifoldable1 t, Bitraversable t) => Bitraversable1 t where #
Minimal complete definition
Methods
bitraverse1 :: Apply f => (a -> f b) -> (c -> f d) -> t a c -> f (t b d) #
bisequence1 :: Apply f => t (f a) (f b) -> f (t a b) #
Instances
| Bitraversable1 Either | |
| Bitraversable1 (,) | |
| Bitraversable1 Arg | |
| Bitraversable1 ((,,) x) | |
| Bitraversable1 (Const *) | |
| Bitraversable1 (Tagged *) | |
| Bitraversable1 ((,,,) x y) | |
| Bitraversable1 ((,,,,) x y z) | |
| Bitraversable1 p => Bitraversable1 (WrappedBifunctor * * p) | |
| Traversable1 g => Bitraversable1 (Joker * * g) | |
| Bitraversable1 p => Bitraversable1 (Flip * * p) | |
| Traversable1 f => Bitraversable1 (Clown * * f) | |
| (Bitraversable1 f, Bitraversable1 g) => Bitraversable1 (Product * * f g) | |
| (Traversable1 f, Bitraversable1 p) => Bitraversable1 (Tannen * * * f p) | |
| (Bitraversable1 p, Traversable1 f, Traversable1 g) => Bitraversable1 (Biff * * * * p f g) | |
bifoldMap1Default :: (Bitraversable1 t, Semigroup m) => (a -> m) -> (b -> m) -> t a b -> m #
class Foldable t => Foldable1 t where #
Instances
| Foldable1 V1 | |
| Foldable1 Par1 | |
| Foldable1 Identity | |
| Foldable1 NonEmpty | |
| Foldable1 Complex | |
| Foldable1 Tree | |
| Foldable1 f => Foldable1 (Rec1 f) | |
| Foldable1 ((,) a) | |
| Foldable1 f => Foldable1 (Lift f) | |
| (Foldable1 f, Foldable1 g) => Foldable1 ((:+:) f g) | |
| (Foldable1 f, Foldable1 g) => Foldable1 ((:*:) f g) | |
| (Foldable1 f, Foldable1 g) => Foldable1 ((:.:) f g) | |
| Bifoldable1 p => Foldable1 (Join * p) | |
| Foldable1 m => Foldable1 (IdentityT * m) | |
| Foldable1 (Tagged * a) | |
| Foldable1 f => Foldable1 (Reverse * f) | |
| Foldable1 f => Foldable1 (Backwards * f) | |
| Foldable1 f => Foldable1 (M1 i c f) | |
| (Foldable1 f, Foldable1 g) => Foldable1 (Sum * f g) | |
| (Foldable1 f, Foldable1 g) => Foldable1 (Product * f g) | |
| (Foldable1 f, Foldable1 g) => Foldable1 (Compose * * f g) | |
| Foldable1 g => Foldable1 (Joker * * g a) | |
intercalate1 :: (Foldable1 t, Semigroup m) => m -> t m -> m #
Insert an m between each pair of 't m'. Equivalent to
intercalateMap1 with id as the second argument.
>>>intercalate1 ", " $ "hello" :| ["how", "are", "you"]"hello, how, are, you"
>>>intercalate1 ", " $ "hello" :| []"hello"
>>>intercalate1 mempty $ "I" :| ["Am", "Fine", "You?"]"IAmFineYou?"
intercalateMap1 :: (Foldable1 t, Semigroup m) => m -> (a -> m) -> t a -> m #
Insert m between each pair of m derived from a.
>>>intercalateMap1 " " show $ True :| [False, True]"True False True"
>>>intercalateMap1 " " show $ True :| []"True"
traverse1_ :: (Foldable1 t, Apply f) => (a -> f b) -> t a -> f () #
sequenceA1_ :: (Foldable1 t, Apply f) => t (f a) -> f () #
foldMapDefault1 :: (Foldable1 t, Monoid m) => (a -> m) -> t a -> m #
Usable default for foldMap, but only if you define foldMap1 yourself
class (Foldable1 t, Traversable t) => Traversable1 t where #
Instances
| Traversable1 V1 | |
| Traversable1 Par1 | |
| Traversable1 Identity | |
| Traversable1 NonEmpty | |
| Traversable1 Complex | |
| Traversable1 Tree | |
| Traversable1 f => Traversable1 (Rec1 f) | |
| Traversable1 ((,) a) | |
| Traversable1 f => Traversable1 (Lift f) | |
| (Traversable1 f, Traversable1 g) => Traversable1 ((:+:) f g) | |
| (Traversable1 f, Traversable1 g) => Traversable1 ((:*:) f g) | |
| (Traversable1 f, Traversable1 g) => Traversable1 ((:.:) f g) | |
| Bitraversable1 p => Traversable1 (Join * p) | |
| Traversable1 f => Traversable1 (IdentityT * f) | |
| Traversable1 (Tagged * a) | |
| Traversable1 f => Traversable1 (Reverse * f) | |
| Traversable1 f => Traversable1 (Backwards * f) | |
| Traversable1 f => Traversable1 (M1 i c f) | |
| (Traversable1 f, Traversable1 g) => Traversable1 (Sum * f g) | |
| (Traversable1 f, Traversable1 g) => Traversable1 (Product * f g) | |
| (Traversable1 f, Traversable1 g) => Traversable1 (Compose * * f g) | |
| Traversable1 g => Traversable1 (Joker * * g a) | |
foldMap1Default :: (Traversable1 f, Semigroup m) => (a -> m) -> f a -> m #
class Semigroupoid k c where #
Minimal complete definition
Instances
| Category k k1 => Semigroupoid k (WrappedCategory k k k1) | |
| Semigroup m => Semigroupoid k (Semi k k m) | |
| Semigroupoid * (->) | |
| Semigroupoid * (,) | http://en.wikipedia.org/wiki/Band_(mathematics)#Rectangular_bands |
| Semigroupoid * Op | |
| Bind m => Semigroupoid * (Kleisli m) | |
| Semigroupoid * (Const *) | |
| Extend w => Semigroupoid * (Cokleisli w) | |
| Apply f => Semigroupoid * (Static f) | |
| Semigroupoid * (Tagged *) | |
data WrappedCategory k k1 k2 a b :: forall k k1. (k1 -> k -> *) -> k1 -> k -> * #
Instances
| Category k k1 => Category k (WrappedCategory k k k1) | |
| Category k k1 => Semigroupoid k (WrappedCategory k k k1) | |
class Semigroupoid k k1 => Ob k k1 a where #
Minimal complete definition
data Static f a b :: (* -> *) -> * -> * -> * #
Instances
| Applicative f => Arrow (Static f) | |
| Alternative f => ArrowZero (Static f) | |
| Alternative f => ArrowPlus (Static f) | |
| Applicative f => ArrowChoice (Static f) | |
| Applicative f => Category * (Static f) | |
| Apply f => Semigroupoid * (Static f) | |
| Functor f => Functor (Static f a) | |
| Applicative f => Applicative (Static f a) | |
| (Comonad f, Monoid a) => Comonad (Static f a) | |
| Plus f => Plus (Static f a) | |
| Alt f => Alt (Static f a) | |
| Apply f => Apply (Static f a) | |
| (Extend f, Semigroup a) => Extend (Static f a) | |