Copyright | (C) 2011-2015 Edward Kmett |
---|---|
License | BSD-style (see the file LICENSE) |
Maintainer | Edward Kmett <ekmett@gmail.com> |
Stability | provisional |
Portability | polykinds |
Safe Haskell | Trustworthy |
Language | Haskell98 |
Data.Semifunctor
Description
- class (Semigroupoid c, Semigroupoid d) => Semifunctor f c d | f c -> d, f d -> c where
- data Bi p a where
- (#) :: a -> b -> Bi (,) '(a, b)
- semibimap :: Semifunctor p (Product l r) cod => l a b -> r c d -> cod (p '(a, c)) (p '(b, d))
- semifirst :: (Semifunctor p (Product l r) cod, Ob r c) => l a b -> cod (p '(a, c)) (p '(b, c))
- semisecond :: (Semifunctor p (Product l r) cod, Ob l a) => r b c -> cod (p '(a, b)) (p '(a, c))
- first :: (Semifunctor p (Product l r) cod, Category r) => l a b -> cod (p '(a, c)) (p '(b, c))
- second :: (Semifunctor p (Product l r) cod, Category l) => r b c -> cod (p '(a, b)) (p '(a, c))
- data WrappedFunctor f a = WrapFunctor {
- unwrapFunctor :: f a
- data WrappedTraversable1 f a = WrapTraversable1 {
- unwrapTraversable1 :: f a
- module Control.Category
- module Data.Semigroupoid
- module Data.Semigroupoid.Ob
- module Data.Semigroupoid.Product
Documentation
class (Semigroupoid c, Semigroupoid d) => Semifunctor f c d | f c -> d, f d -> c where #
Semifunctors map objects to objects, and arrows to arrows preserving connectivity as normal functors, but do not purport to preserve identity arrows. We apply them to semigroupoids, because those don't even claim to offer identity arrows!
Minimal complete definition
Instances
Semifunctor k k1 f c d => Semifunctor k k1 f (Dual k1 k1 c) (Dual k k d) # | |
Functor f => Semifunctor * * (WrappedFunctor * f) (->) (->) # | |
(Traversable1 f, Bind m) => Semifunctor * * (WrappedTraversable1 * f) (Kleisli m) (Kleisli m) # | |
(Traversable f, Bind m, Monad m) => Semifunctor * * (WrappedFunctor * f) (Kleisli m) (Kleisli m) # | |
Semifunctor * (*, *) (Bi * * Either) (Product * * * * (->) (->)) (->) # | |
Semifunctor * (*, *) (Bi * * (,)) (Product * * * * (->) (->)) (->) # | |
Bind m => Semifunctor * (*, *) (Bi * * Either) (Product * * * * (Kleisli m) (Kleisli m)) (Kleisli m) # | |
Bind m => Semifunctor * (*, *) (Bi * * (,)) (Product * * * * (Kleisli m) (Kleisli m)) (Kleisli m) # | |
Used to map a more traditional bifunctor into a semifunctor
Instances
semibimap :: Semifunctor p (Product l r) cod => l a b -> r c d -> cod (p '(a, c)) (p '(b, d)) #
semifirst :: (Semifunctor p (Product l r) cod, Ob r c) => l a b -> cod (p '(a, c)) (p '(b, c)) #
semisecond :: (Semifunctor p (Product l r) cod, Ob l a) => r b c -> cod (p '(a, b)) (p '(a, c)) #
first :: (Semifunctor p (Product l r) cod, Category r) => l a b -> cod (p '(a, c)) (p '(b, c)) #
second :: (Semifunctor p (Product l r) cod, Category l) => r b c -> cod (p '(a, b)) (p '(a, c)) #
data WrappedFunctor f a #
Constructors
WrapFunctor | |
Fields
|
Instances
Functor f => Semifunctor * * (WrappedFunctor * f) (->) (->) # | |
(Traversable f, Bind m, Monad m) => Semifunctor * * (WrappedFunctor * f) (Kleisli m) (Kleisli m) # | |
data WrappedTraversable1 f a #
Constructors
WrapTraversable1 | |
Fields
|
Instances
(Traversable1 f, Bind m) => Semifunctor * * (WrappedTraversable1 * f) (Kleisli m) (Kleisli m) # | |
module Control.Category
module Data.Semigroupoid
module Data.Semigroupoid.Ob
module Data.Semigroupoid.Product