monad-ideals-0.1.0.0: Ideal Monads and coproduct of them
Copyright(C) 2024 Koji Miyazato
LicenseBSD-style (see the file LICENSE)
MaintainerKoji Miyazato <viercc@gmail.com>
Stabilityexperimental
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Functor.KeepLeft

Description

 
Synopsis

Documentation

newtype KeepLeft c a Source #

Another choices of instances for Const. KeepLeft c have Apply instance isomorphic to Const (First c), which can also (exceptionally) have Bind instance.

The most used constant functor Const lacks the instance of Bind, due to incompatibility between Bind and Apply.

instance (Semigroup c) => Apply (Const c)

While any Semigroup c instance yields a lawful Apply (Const c) instance, large number of them do not have Bind (Const c) instance compatible to Apply. One of few exceptional Semigroup instance is the one defined as below, which is isomorphic to First c semigroup.

(<>) :: c -> c -> c
x <> _ = x

Constructors

KeepLeft 

Fields

Instances

Instances details
Bifoldable KeepLeft Source # 
Instance details

Defined in Data.Functor.KeepLeft

Methods

bifold :: Monoid m => KeepLeft m m -> m #

bifoldMap :: Monoid m => (a -> m) -> (b -> m) -> KeepLeft a b -> m #

bifoldr :: (a -> c -> c) -> (b -> c -> c) -> c -> KeepLeft a b -> c #

bifoldl :: (c -> a -> c) -> (c -> b -> c) -> c -> KeepLeft a b -> c #

Bifoldable1 KeepLeft Source # 
Instance details

Defined in Data.Functor.KeepLeft

Methods

bifold1 :: Semigroup m => KeepLeft m m -> m #

bifoldMap1 :: Semigroup m => (a -> m) -> (b -> m) -> KeepLeft a b -> m #

Bifunctor KeepLeft Source # 
Instance details

Defined in Data.Functor.KeepLeft

Methods

bimap :: (a -> b) -> (c -> d) -> KeepLeft a c -> KeepLeft b d #

first :: (a -> b) -> KeepLeft a c -> KeepLeft b c #

second :: (b -> c) -> KeepLeft a b -> KeepLeft a c #

Bitraversable KeepLeft Source # 
Instance details

Defined in Data.Functor.KeepLeft

Methods

bitraverse :: Applicative f => (a -> f c) -> (b -> f d) -> KeepLeft a b -> f (KeepLeft c d) #

Eq2 KeepLeft Source # 
Instance details

Defined in Data.Functor.KeepLeft

Methods

liftEq2 :: (a -> b -> Bool) -> (c -> d -> Bool) -> KeepLeft a c -> KeepLeft b d -> Bool #

Ord2 KeepLeft Source # 
Instance details

Defined in Data.Functor.KeepLeft

Methods

liftCompare2 :: (a -> b -> Ordering) -> (c -> d -> Ordering) -> KeepLeft a c -> KeepLeft b d -> Ordering #

Bitraversable1 KeepLeft Source # 
Instance details

Defined in Data.Functor.KeepLeft

Methods

bitraverse1 :: Apply f => (a -> f b) -> (c -> f d) -> KeepLeft a c -> f (KeepLeft b d) #

bisequence1 :: Apply f => KeepLeft (f a) (f b) -> f (KeepLeft a b) #

Foldable (KeepLeft c) Source # 
Instance details

Defined in Data.Functor.KeepLeft

Methods

fold :: Monoid m => KeepLeft c m -> m #

foldMap :: Monoid m => (a -> m) -> KeepLeft c a -> m #

foldMap' :: Monoid m => (a -> m) -> KeepLeft c a -> m #

foldr :: (a -> b -> b) -> b -> KeepLeft c a -> b #

foldr' :: (a -> b -> b) -> b -> KeepLeft c a -> b #

foldl :: (b -> a -> b) -> b -> KeepLeft c a -> b #

foldl' :: (b -> a -> b) -> b -> KeepLeft c a -> b #

foldr1 :: (a -> a -> a) -> KeepLeft c a -> a #

foldl1 :: (a -> a -> a) -> KeepLeft c a -> a #

toList :: KeepLeft c a -> [a] #

null :: KeepLeft c a -> Bool #

length :: KeepLeft c a -> Int #

elem :: Eq a => a -> KeepLeft c a -> Bool #

maximum :: Ord a => KeepLeft c a -> a #

minimum :: Ord a => KeepLeft c a -> a #

sum :: Num a => KeepLeft c a -> a #

product :: Num a => KeepLeft c a -> a #

Eq c => Eq1 (KeepLeft c) Source # 
Instance details

Defined in Data.Functor.KeepLeft

Methods

liftEq :: (a -> b -> Bool) -> KeepLeft c a -> KeepLeft c b -> Bool #

Ord c => Ord1 (KeepLeft c) Source # 
Instance details

Defined in Data.Functor.KeepLeft

Methods

liftCompare :: (a -> b -> Ordering) -> KeepLeft c a -> KeepLeft c b -> Ordering #

Traversable (KeepLeft c) Source # 
Instance details

Defined in Data.Functor.KeepLeft

Methods

traverse :: Applicative f => (a -> f b) -> KeepLeft c a -> f (KeepLeft c b) #

sequenceA :: Applicative f => KeepLeft c (f a) -> f (KeepLeft c a) #

mapM :: Monad m => (a -> m b) -> KeepLeft c a -> m (KeepLeft c b) #

sequence :: Monad m => KeepLeft c (m a) -> m (KeepLeft c a) #

Functor (KeepLeft c) Source # 
Instance details

Defined in Data.Functor.KeepLeft

Methods

fmap :: (a -> b) -> KeepLeft c a -> KeepLeft c b #

(<$) :: a -> KeepLeft c b -> KeepLeft c a #

MonadIdeal (KeepLeft c) Source #
Ideal (KeepLeft c) a ~ Either c a
Instance details

Defined in Data.Functor.KeepLeft

Methods

idealBind :: KeepLeft c a -> (a -> Ideal (KeepLeft c) b) -> KeepLeft c b Source #

Isolated (KeepLeft c) Source # 
Instance details

Defined in Data.Functor.KeepLeft

Methods

impureBind :: KeepLeft c a -> (a -> Unite (KeepLeft c) b) -> Unite (KeepLeft c) b Source #

Apply (KeepLeft c) Source # 
Instance details

Defined in Data.Functor.KeepLeft

Methods

(<.>) :: KeepLeft c (a -> b) -> KeepLeft c a -> KeepLeft c b #

(.>) :: KeepLeft c a -> KeepLeft c b -> KeepLeft c b #

(<.) :: KeepLeft c a -> KeepLeft c b -> KeepLeft c a #

liftF2 :: (a -> b -> c0) -> KeepLeft c a -> KeepLeft c b -> KeepLeft c c0 #

Bind (KeepLeft c) Source # 
Instance details

Defined in Data.Functor.KeepLeft

Methods

(>>-) :: KeepLeft c a -> (a -> KeepLeft c b) -> KeepLeft c b #

join :: KeepLeft c (KeepLeft c a) -> KeepLeft c a #

Semigroup (KeepLeft c a) Source # 
Instance details

Defined in Data.Functor.KeepLeft

Methods

(<>) :: KeepLeft c a -> KeepLeft c a -> KeepLeft c a #

sconcat :: NonEmpty (KeepLeft c a) -> KeepLeft c a #

stimes :: Integral b => b -> KeepLeft c a -> KeepLeft c a #

Read c => Read (KeepLeft c a) Source # 
Instance details

Defined in Data.Functor.KeepLeft

Show c => Show (KeepLeft c a) Source # 
Instance details

Defined in Data.Functor.KeepLeft

Methods

showsPrec :: Int -> KeepLeft c a -> ShowS #

show :: KeepLeft c a -> String #

showList :: [KeepLeft c a] -> ShowS #

Eq c => Eq (KeepLeft c a) Source # 
Instance details

Defined in Data.Functor.KeepLeft

Methods

(==) :: KeepLeft c a -> KeepLeft c a -> Bool #

(/=) :: KeepLeft c a -> KeepLeft c a -> Bool #

Ord c => Ord (KeepLeft c a) Source # 
Instance details

Defined in Data.Functor.KeepLeft

Methods

compare :: KeepLeft c a -> KeepLeft c a -> Ordering #

(<) :: KeepLeft c a -> KeepLeft c a -> Bool #

(<=) :: KeepLeft c a -> KeepLeft c a -> Bool #

(>) :: KeepLeft c a -> KeepLeft c a -> Bool #

(>=) :: KeepLeft c a -> KeepLeft c a -> Bool #

max :: KeepLeft c a -> KeepLeft c a -> KeepLeft c a #

min :: KeepLeft c a -> KeepLeft c a -> KeepLeft c a #