linear-base-0.4.0: Standard library for linear types.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Functor.Linear

Description

The data functor hierarchy

This module defines the data functor library. Unlike in the case of non-linear, unrestricted, functors, there is a split between data functors, which represent containers, and control functors which represent effects. Please read this blog post. For more details, see Control.Functor.Linear.

  • Linear data functors should be thought of as containers of data.
  • Linear data applicative functors should be thought of as containers that can be zipped.
  • Linear data traversable functors should be thought of as containers which store a finite number of values.

This module also defines genericTraverse for types implementing Generic1.

Synopsis

Data Functor Hierarchy

class Functor f where Source #

Linear Data Functors should be thought of as containers holding values of type a over which you are able to apply a linear function of type a %1-> b on each value of type a in the functor and consume a given functor of type f a.

Methods

fmap :: (a %1 -> b) -> f a %1 -> f b Source #

Instances

Instances details
Functor Identity Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Functor

Methods

fmap :: (a %1 -> b) -> Identity a %1 -> Identity b Source #

Functor Par1 Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Functor

Methods

fmap :: (a %1 -> b) -> Par1 a %1 -> Par1 b Source #

Functor Array Source # 
Instance details

Defined in Data.Array.Mutable.Linear.Internal

Methods

fmap :: (a %1 -> b) -> Array a %1 -> Array b Source #

Functor Array Source # 
Instance details

Defined in Data.Array.Polarized.Pull.Internal

Methods

fmap :: (a %1 -> b) -> Array a %1 -> Array b Source #

Functor Array Source # 
Instance details

Defined in Data.Array.Polarized.Push

Methods

fmap :: (a %1 -> b) -> Array a %1 -> Array b Source #

Functor Replicator Source # 
Instance details

Defined in Data.Replicator.Linear.Internal.Instances

Methods

fmap :: (a %1 -> b) -> Replicator a %1 -> Replicator b Source #

Functor Ur Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Functor

Methods

fmap :: (a %1 -> b) -> Ur a %1 -> Ur b Source #

Functor Vector Source # 
Instance details

Defined in Data.Vector.Mutable.Linear.Internal

Methods

fmap :: (a %1 -> b) -> Vector a %1 -> Vector b Source #

Functor IO Source # 
Instance details

Defined in System.IO.Linear

Methods

fmap :: (a %1 -> b) -> IO a %1 -> IO b Source #

Functor RIO Source # 
Instance details

Defined in System.IO.Resource.Linear.Internal

Methods

fmap :: (a %1 -> b) -> RIO a %1 -> RIO b Source #

Functor Maybe Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Functor

Methods

fmap :: (a %1 -> b) -> Maybe a %1 -> Maybe b Source #

Functor [] Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Functor

Methods

fmap :: (a %1 -> b) -> [a] %1 -> [b] Source #

Functor (Either e) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Functor

Methods

fmap :: (a %1 -> b) -> Either e a %1 -> Either e b Source #

Functor (U1 :: Type -> Type) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Functor

Methods

fmap :: (a %1 -> b) -> U1 a %1 -> U1 b Source #

Functor (UAddr :: Type -> Type) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Functor

Methods

fmap :: (a %1 -> b) -> UAddr a %1 -> UAddr b Source #

Functor (UChar :: Type -> Type) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Functor

Methods

fmap :: (a %1 -> b) -> UChar a %1 -> UChar b Source #

Functor (UDouble :: Type -> Type) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Functor

Methods

fmap :: (a %1 -> b) -> UDouble a %1 -> UDouble b Source #

Functor (UFloat :: Type -> Type) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Functor

Methods

fmap :: (a %1 -> b) -> UFloat a %1 -> UFloat b Source #

Functor (UInt :: Type -> Type) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Functor

Methods

fmap :: (a %1 -> b) -> UInt a %1 -> UInt b Source #

Functor (UWord :: Type -> Type) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Functor

Methods

fmap :: (a %1 -> b) -> UWord a %1 -> UWord b Source #

Functor (V1 :: Type -> Type) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Functor

Methods

fmap :: (a %1 -> b) -> V1 a %1 -> V1 b Source #

Functor f => Functor (Data f) Source # 
Instance details

Defined in Control.Functor.Linear.Internal.Instances

Methods

fmap :: (a %1 -> b) -> Data f a %1 -> Data f b Source #

Functor (HashMap k) Source # 
Instance details

Defined in Data.HashMap.Mutable.Linear.Internal

Methods

fmap :: (a %1 -> b) -> HashMap k a %1 -> HashMap k b Source #

Functor (V n) Source # 
Instance details

Defined in Data.V.Linear.Internal.Instances

Methods

fmap :: (a %1 -> b) -> V n a %1 -> V n b Source #

(Generic1 f, Functor (Rep1 f)) => Functor (Generically1 f) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Functor

Methods

fmap :: (a %1 -> b) -> Generically1 f a %1 -> Generically1 f b Source #

Functor (Of a) Source # 
Instance details

Defined in Streaming.Linear.Internal.Type

Methods

fmap :: (a0 %1 -> b) -> Of a a0 %1 -> Of a b Source #

Functor m => Functor (MaybeT m) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Functor

Methods

fmap :: (a %1 -> b) -> MaybeT m a %1 -> MaybeT m b Source #

Functor ((,) a) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Functor

Methods

fmap :: (a0 %1 -> b) -> (a, a0) %1 -> (a, b) Source #

Functor (Const x :: Type -> Type) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Functor

Methods

fmap :: (a %1 -> b) -> Const x a %1 -> Const x b Source #

Functor m => Functor (ReaderT r m) Source # 
Instance details

Defined in Control.Functor.Linear.Internal.Reader

Methods

fmap :: (a %1 -> b) -> ReaderT r m a %1 -> ReaderT r m b Source #

Functor m => Functor (StateT s m) Source # 
Instance details

Defined in Control.Functor.Linear.Internal.State

Methods

fmap :: (a %1 -> b) -> StateT s m a %1 -> StateT s m b Source #

(Functor m, Functor f) => Functor (Stream f m) Source # 
Instance details

Defined in Streaming.Linear.Internal.Type

Methods

fmap :: (a %1 -> b) -> Stream f m a %1 -> Stream f m b Source #

Functor m => Functor (ExceptT e m) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Functor

Methods

fmap :: (a %1 -> b) -> ExceptT e m a %1 -> ExceptT e m b Source #

Functor m => Functor (ReaderT r m) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Functor

Methods

fmap :: (a %1 -> b) -> ReaderT r m a %1 -> ReaderT r m b Source #

Functor m => Functor (StateT s m) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Functor

Methods

fmap :: (a %1 -> b) -> StateT s m a %1 -> StateT s m b Source #

Functor ((,,) a b) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Functor

Methods

fmap :: (a0 %1 -> b0) -> (a, b, a0) %1 -> (a, b, b0) Source #

(Functor f, Functor g) => Functor (Product f g) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Functor

Methods

fmap :: (a %1 -> b) -> Product f g a %1 -> Product f g b Source #

(Functor f, Functor g) => Functor (Sum f g) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Functor

Methods

fmap :: (a %1 -> b) -> Sum f g a %1 -> Sum f g b Source #

(Functor f, Functor g) => Functor (f :*: g) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Functor

Methods

fmap :: (a %1 -> b) -> (f :*: g) a %1 -> (f :*: g) b Source #

(Functor f, Functor g) => Functor (f :+: g) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Functor

Methods

fmap :: (a %1 -> b) -> (f :+: g) a %1 -> (f :+: g) b Source #

Functor (K1 i v :: Type -> Type) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Functor

Methods

fmap :: (a %1 -> b) -> K1 i v a %1 -> K1 i v b Source #

Functor f => Functor (MP1 m f) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Functor

Methods

fmap :: (a %1 -> b) -> MP1 m f a %1 -> MP1 m f b Source #

Functor (ContT r m) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Functor

Methods

fmap :: (a %1 -> b) -> ContT r m a %1 -> ContT r m b Source #

Functor ((,,,) a b c) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Functor

Methods

fmap :: (a0 %1 -> b0) -> (a, b, c, a0) %1 -> (a, b, c, b0) Source #

(Functor f, Functor g) => Functor (Compose f g) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Functor

Methods

fmap :: (a %1 -> b) -> Compose f g a %1 -> Compose f g b Source #

Functor f => Functor (M1 i c f) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Functor

Methods

fmap :: (a %1 -> b) -> M1 i c f a %1 -> M1 i c f b Source #

(Functor f, Functor g) => Functor (f :.: g) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Functor

Methods

fmap :: (a %1 -> b) -> (f :.: g) a %1 -> (f :.: g) b Source #

Functor (FUN 'One a :: TYPE LiftedRep -> Type) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Functor

Methods

fmap :: (a0 %1 -> b) -> FUN 'One a a0 %1 -> FUN 'One a b Source #

Functor ((,,,,) a b c d) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Functor

Methods

fmap :: (a0 %1 -> b0) -> (a, b, c, d, a0) %1 -> (a, b, c, d, b0) Source #

(<$>) :: Functor f => (a %1 -> b) -> f a %1 -> f b infixl 4 Source #

(<$) :: (Functor f, Consumable b) => a -> f b %1 -> f a infixl 4 Source #

Replace all occurances of b with the given a and consume the functor f b.

void :: (Functor f, Consumable a) => f a %1 -> f () Source #

Discard a consumable value stored in a data functor.

class Functor f => Applicative f where Source #

Data Applicative-s can be seen as containers which can be zipped together. A prime example of data Applicative are vectors of known length (ZipLists would be, if it were not for the fact that zipping them together drops values, which we are not allowed to do in a linear container).

In fact, an applicative functor is precisely a functor equipped with (pure and) liftA2 :: (a %1-> b %1-> c) -> f a %1-> f b %1-> f c. In the case where f = [], the signature of liftA2 would specialise to that of zipWith.

Intuitively, the type of liftA2 means that Applicatives can be seen as containers whose "number" of elements is known at compile-time. This includes vectors of known length but excludes Maybe, since this may contain either zero or one value. Similarly, ((->) r) forms a Data Applicative, since this is a (possibly infinitary) container indexed by r, while lists do not, since they may contain any number of elements.

Remarks for the mathematically inclined

An Applicative is, as in the restricted case, a lax monoidal endofunctor of the category of linear types. That is, it is equipped with

  • a (linear) function () %1-> f ()
  • a (linear) natural transformation (f a, f b) %1-> f (a, b)

It is a simple exercise to verify that these are equivalent to the definition of Applicative. Hence that the choice of linearity of the various arrow is indeed natural.

Minimal complete definition

pure, (liftA2 | (<*>))

Methods

pure :: a -> f a Source #

(<*>) :: f (a %1 -> b) %1 -> f a %1 -> f b infixl 4 Source #

liftA2 :: (a %1 -> b %1 -> c) -> f a %1 -> f b %1 -> f c Source #

Instances

Instances details
Applicative Identity Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Applicative

Methods

pure :: a -> Identity a Source #

(<*>) :: Identity (a %1 -> b) %1 -> Identity a %1 -> Identity b Source #

liftA2 :: (a %1 -> b %1 -> c) -> Identity a %1 -> Identity b %1 -> Identity c Source #

Applicative Replicator Source # 
Instance details

Defined in Data.Replicator.Linear.Internal.Instances

Methods

pure :: a -> Replicator a Source #

(<*>) :: Replicator (a %1 -> b) %1 -> Replicator a %1 -> Replicator b Source #

liftA2 :: (a %1 -> b %1 -> c) -> Replicator a %1 -> Replicator b %1 -> Replicator c Source #

Applicative Ur Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Applicative

Methods

pure :: a -> Ur a Source #

(<*>) :: Ur (a %1 -> b) %1 -> Ur a %1 -> Ur b Source #

liftA2 :: (a %1 -> b %1 -> c) -> Ur a %1 -> Ur b %1 -> Ur c Source #

Applicative IO Source # 
Instance details

Defined in System.IO.Linear

Methods

pure :: a -> IO a Source #

(<*>) :: IO (a %1 -> b) %1 -> IO a %1 -> IO b Source #

liftA2 :: (a %1 -> b %1 -> c) -> IO a %1 -> IO b %1 -> IO c Source #

Applicative RIO Source # 
Instance details

Defined in System.IO.Resource.Linear.Internal

Methods

pure :: a -> RIO a Source #

(<*>) :: RIO (a %1 -> b) %1 -> RIO a %1 -> RIO b Source #

liftA2 :: (a %1 -> b %1 -> c) -> RIO a %1 -> RIO b %1 -> RIO c Source #

Applicative f => Applicative (Data f) Source # 
Instance details

Defined in Control.Functor.Linear.Internal.Instances

Methods

pure :: a -> Data f a Source #

(<*>) :: Data f (a %1 -> b) %1 -> Data f a %1 -> Data f b Source #

liftA2 :: (a %1 -> b %1 -> c) -> Data f a %1 -> Data f b %1 -> Data f c Source #

KnownNat n => Applicative (V n) Source # 
Instance details

Defined in Data.V.Linear.Internal.Instances

Methods

pure :: a -> V n a Source #

(<*>) :: V n (a %1 -> b) %1 -> V n a %1 -> V n b Source #

liftA2 :: (a %1 -> b %1 -> c) -> V n a %1 -> V n b %1 -> V n c Source #

(Generic1 f, Functor (Rep1 f), GApplicative ('ShowType f) (Rep1 f)) => Applicative (Generically1 f) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Applicative

Methods

pure :: a -> Generically1 f a Source #

(<*>) :: Generically1 f (a %1 -> b) %1 -> Generically1 f a %1 -> Generically1 f b Source #

liftA2 :: (a %1 -> b %1 -> c) -> Generically1 f a %1 -> Generically1 f b %1 -> Generically1 f c Source #

Monoid a => Applicative ((,) a) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Applicative

Methods

pure :: a0 -> (a, a0) Source #

(<*>) :: (a, a0 %1 -> b) %1 -> (a, a0) %1 -> (a, b) Source #

liftA2 :: (a0 %1 -> b %1 -> c) -> (a, a0) %1 -> (a, b) %1 -> (a, c) Source #

Monoid x => Applicative (Const x :: Type -> Type) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Applicative

Methods

pure :: a -> Const x a Source #

(<*>) :: Const x (a %1 -> b) %1 -> Const x a %1 -> Const x b Source #

liftA2 :: (a %1 -> b %1 -> c) -> Const x a %1 -> Const x b %1 -> Const x c Source #

(Applicative m, Dupable r) => Applicative (ReaderT r m) Source # 
Instance details

Defined in Control.Functor.Linear.Internal.Reader

Methods

pure :: a -> ReaderT r m a Source #

(<*>) :: ReaderT r m (a %1 -> b) %1 -> ReaderT r m a %1 -> ReaderT r m b Source #

liftA2 :: (a %1 -> b %1 -> c) -> ReaderT r m a %1 -> ReaderT r m b %1 -> ReaderT r m c Source #

Monad m => Applicative (StateT s m) Source # 
Instance details

Defined in Control.Functor.Linear.Internal.State

Methods

pure :: a -> StateT s m a Source #

(<*>) :: StateT s m (a %1 -> b) %1 -> StateT s m a %1 -> StateT s m b Source #

liftA2 :: (a %1 -> b %1 -> c) -> StateT s m a %1 -> StateT s m b %1 -> StateT s m c Source #

(Functor m, Functor f) => Applicative (Stream f m) Source # 
Instance details

Defined in Streaming.Linear.Internal.Type

Methods

pure :: a -> Stream f m a Source #

(<*>) :: Stream f m (a %1 -> b) %1 -> Stream f m a %1 -> Stream f m b Source #

liftA2 :: (a %1 -> b %1 -> c) -> Stream f m a %1 -> Stream f m b %1 -> Stream f m c Source #

Applicative m => Applicative (ReaderT r m) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Applicative

Methods

pure :: a -> ReaderT r m a Source #

(<*>) :: ReaderT r m (a %1 -> b) %1 -> ReaderT r m a %1 -> ReaderT r m b Source #

liftA2 :: (a %1 -> b %1 -> c) -> ReaderT r m a %1 -> ReaderT r m b %1 -> ReaderT r m c Source #

(Monoid a, Monoid b) => Applicative ((,,) a b) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Applicative

Methods

pure :: a0 -> (a, b, a0) Source #

(<*>) :: (a, b, a0 %1 -> b0) %1 -> (a, b, a0) %1 -> (a, b, b0) Source #

liftA2 :: (a0 %1 -> b0 %1 -> c) -> (a, b, a0) %1 -> (a, b, b0) %1 -> (a, b, c) Source #

(Applicative f, Applicative g) => Applicative (Product f g) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Applicative

Methods

pure :: a -> Product f g a Source #

(<*>) :: Product f g (a %1 -> b) %1 -> Product f g a %1 -> Product f g b Source #

liftA2 :: (a %1 -> b %1 -> c) -> Product f g a %1 -> Product f g b %1 -> Product f g c Source #

(Applicative f, Applicative g) => Applicative (f :*: g) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Applicative

Methods

pure :: a -> (f :*: g) a Source #

(<*>) :: (f :*: g) (a %1 -> b) %1 -> (f :*: g) a %1 -> (f :*: g) b Source #

liftA2 :: (a %1 -> b %1 -> c) -> (f :*: g) a %1 -> (f :*: g) b %1 -> (f :*: g) c Source #

(Monoid a, Monoid b, Monoid c) => Applicative ((,,,) a b c) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Applicative

Methods

pure :: a0 -> (a, b, c, a0) Source #

(<*>) :: (a, b, c, a0 %1 -> b0) %1 -> (a, b, c, a0) %1 -> (a, b, c, b0) Source #

liftA2 :: (a0 %1 -> b0 %1 -> c0) -> (a, b, c, a0) %1 -> (a, b, c, b0) %1 -> (a, b, c, c0) Source #

(Applicative f, Applicative g) => Applicative (Compose f g) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Applicative

Methods

pure :: a -> Compose f g a Source #

(<*>) :: Compose f g (a %1 -> b) %1 -> Compose f g a %1 -> Compose f g b Source #

liftA2 :: (a %1 -> b %1 -> c) -> Compose f g a %1 -> Compose f g b %1 -> Compose f g c Source #

newtype Const a (b :: k) #

The Const functor.

Constructors

Const 

Fields

Instances

Instances details
Strong Either Void (CoKleisli (Const x :: Type -> Type)) Source # 
Instance details

Defined in Data.Profunctor.Kleisli.Linear

Methods

first :: CoKleisli (Const x) a b -> CoKleisli (Const x) (Either a c) (Either b c) Source #

second :: CoKleisli (Const x) b c -> CoKleisli (Const x) (Either a b) (Either a c) Source #

Generic1 (Const a :: k -> Type) 
Instance details

Defined in Data.Functor.Const

Associated Types

type Rep1 (Const a) :: k -> Type #

Methods

from1 :: forall (a0 :: k0). Const a a0 -> Rep1 (Const a) a0 #

to1 :: forall (a0 :: k0). Rep1 (Const a) a0 -> Const a a0 #

Bifunctor (Const :: Type -> Type -> Type)

Since: base-4.8.0.0

Instance details

Defined in Data.Bifunctor

Methods

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

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

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

Eq2 (Const :: Type -> Type -> Type)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Methods

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

Ord2 (Const :: Type -> Type -> Type)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Methods

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

Read2 (Const :: Type -> Type -> Type)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftReadsPrec2 :: (Int -> ReadS a) -> ReadS [a] -> (Int -> ReadS b) -> ReadS [b] -> Int -> ReadS (Const a b) #

liftReadList2 :: (Int -> ReadS a) -> ReadS [a] -> (Int -> ReadS b) -> ReadS [b] -> ReadS [Const a b] #

liftReadPrec2 :: ReadPrec a -> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec (Const a b) #

liftReadListPrec2 :: ReadPrec a -> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec [Const a b] #

Show2 (Const :: Type -> TYPE LiftedRep -> Type)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftShowsPrec2 :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> (Int -> b -> ShowS) -> ([b] -> ShowS) -> Int -> Const a b -> ShowS #

liftShowList2 :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> (Int -> b -> ShowS) -> ([b] -> ShowS) -> [Const a b] -> ShowS #

Hashable2 (Const :: Type -> Type -> Type) 
Instance details

Defined in Data.Hashable.Class

Methods

liftHashWithSalt2 :: (Int -> a -> Int) -> (Int -> b -> Int) -> Int -> Const a b -> Int #

Foldable (Const m :: TYPE LiftedRep -> Type)

Since: base-4.7.0.0

Instance details

Defined in Data.Functor.Const

Methods

fold :: Monoid m0 => Const m m0 -> m0 #

foldMap :: Monoid m0 => (a -> m0) -> Const m a -> m0 #

foldMap' :: Monoid m0 => (a -> m0) -> Const m a -> m0 #

foldr :: (a -> b -> b) -> b -> Const m a -> b #

foldr' :: (a -> b -> b) -> b -> Const m a -> b #

foldl :: (b -> a -> b) -> b -> Const m a -> b #

foldl' :: (b -> a -> b) -> b -> Const m a -> b #

foldr1 :: (a -> a -> a) -> Const m a -> a #

foldl1 :: (a -> a -> a) -> Const m a -> a #

toList :: Const m a -> [a] #

null :: Const m a -> Bool #

length :: Const m a -> Int #

elem :: Eq a => a -> Const m a -> Bool #

maximum :: Ord a => Const m a -> a #

minimum :: Ord a => Const m a -> a #

sum :: Num a => Const m a -> a #

product :: Num a => Const m a -> a #

Eq a => Eq1 (Const a :: Type -> Type)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftEq :: (a0 -> b -> Bool) -> Const a a0 -> Const a b -> Bool #

Ord a => Ord1 (Const a :: Type -> Type)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftCompare :: (a0 -> b -> Ordering) -> Const a a0 -> Const a b -> Ordering #

Read a => Read1 (Const a :: Type -> Type)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftReadsPrec :: (Int -> ReadS a0) -> ReadS [a0] -> Int -> ReadS (Const a a0) #

liftReadList :: (Int -> ReadS a0) -> ReadS [a0] -> ReadS [Const a a0] #

liftReadPrec :: ReadPrec a0 -> ReadPrec [a0] -> ReadPrec (Const a a0) #

liftReadListPrec :: ReadPrec a0 -> ReadPrec [a0] -> ReadPrec [Const a a0] #

Show a => Show1 (Const a :: TYPE LiftedRep -> Type)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftShowsPrec :: (Int -> a0 -> ShowS) -> ([a0] -> ShowS) -> Int -> Const a a0 -> ShowS #

liftShowList :: (Int -> a0 -> ShowS) -> ([a0] -> ShowS) -> [Const a a0] -> ShowS #

Traversable (Const m :: Type -> Type)

Since: base-4.7.0.0

Instance details

Defined in Data.Traversable

Methods

traverse :: Applicative f => (a -> f b) -> Const m a -> f (Const m b) #

sequenceA :: Applicative f => Const m (f a) -> f (Const m a) #

mapM :: Monad m0 => (a -> m0 b) -> Const m a -> m0 (Const m b) #

sequence :: Monad m0 => Const m (m0 a) -> m0 (Const m a) #

Monoid m => Applicative (Const m :: Type -> Type)

Since: base-2.0.1

Instance details

Defined in Data.Functor.Const

Methods

pure :: a -> Const m a #

(<*>) :: Const m (a -> b) -> Const m a -> Const m b #

liftA2 :: (a -> b -> c) -> Const m a -> Const m b -> Const m c #

(*>) :: Const m a -> Const m b -> Const m b #

(<*) :: Const m a -> Const m b -> Const m a #

Functor (Const m :: Type -> Type)

Since: base-2.1

Instance details

Defined in Data.Functor.Const

Methods

fmap :: (a -> b) -> Const m a -> Const m b #

(<$) :: a -> Const m b -> Const m a #

Hashable a => Hashable1 (Const a :: Type -> Type) 
Instance details

Defined in Data.Hashable.Class

Methods

liftHashWithSalt :: (Int -> a0 -> Int) -> Int -> Const a a0 -> Int #

Monoid x => Applicative (Const x :: Type -> Type) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Applicative

Methods

pure :: a -> Const x a Source #

(<*>) :: Const x (a %1 -> b) %1 -> Const x a %1 -> Const x b Source #

liftA2 :: (a %1 -> b %1 -> c) -> Const x a %1 -> Const x b %1 -> Const x c Source #

Functor (Const x :: Type -> Type) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Functor

Methods

fmap :: (a %1 -> b) -> Const x a %1 -> Const x b Source #

Traversable (Const a :: Type -> Type) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Traversable

Methods

traverse :: Applicative f => (a0 %1 -> f b) -> Const a a0 %1 -> f (Const a b) Source #

sequence :: Applicative f => Const a (f a0) %1 -> f (Const a a0) Source #

IsString a => IsString (Const a b)

Since: base-4.9.0.0

Instance details

Defined in Data.String

Methods

fromString :: String -> Const a b #

Storable a => Storable (Const a b)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Const

Methods

sizeOf :: Const a b -> Int #

alignment :: Const a b -> Int #

peekElemOff :: Ptr (Const a b) -> Int -> IO (Const a b) #

pokeElemOff :: Ptr (Const a b) -> Int -> Const a b -> IO () #

peekByteOff :: Ptr b0 -> Int -> IO (Const a b) #

pokeByteOff :: Ptr b0 -> Int -> Const a b -> IO () #

peek :: Ptr (Const a b) -> IO (Const a b) #

poke :: Ptr (Const a b) -> Const a b -> IO () #

Monoid a => Monoid (Const a b)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Const

Methods

mempty :: Const a b #

mappend :: Const a b -> Const a b -> Const a b #

mconcat :: [Const a b] -> Const a b #

Semigroup a => Semigroup (Const a b)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Const

Methods

(<>) :: Const a b -> Const a b -> Const a b #

sconcat :: NonEmpty (Const a b) -> Const a b #

stimes :: Integral b0 => b0 -> Const a b -> Const a b #

Bits a => Bits (Const a b)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Const

Methods

(.&.) :: Const a b -> Const a b -> Const a b #

(.|.) :: Const a b -> Const a b -> Const a b #

xor :: Const a b -> Const a b -> Const a b #

complement :: Const a b -> Const a b #

shift :: Const a b -> Int -> Const a b #

rotate :: Const a b -> Int -> Const a b #

zeroBits :: Const a b #

bit :: Int -> Const a b #

setBit :: Const a b -> Int -> Const a b #

clearBit :: Const a b -> Int -> Const a b #

complementBit :: Const a b -> Int -> Const a b #

testBit :: Const a b -> Int -> Bool #

bitSizeMaybe :: Const a b -> Maybe Int #

bitSize :: Const a b -> Int #

isSigned :: Const a b -> Bool #

shiftL :: Const a b -> Int -> Const a b #

unsafeShiftL :: Const a b -> Int -> Const a b #

shiftR :: Const a b -> Int -> Const a b #

unsafeShiftR :: Const a b -> Int -> Const a b #

rotateL :: Const a b -> Int -> Const a b #

rotateR :: Const a b -> Int -> Const a b #

popCount :: Const a b -> Int #

FiniteBits a => FiniteBits (Const a b)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Const

Bounded a => Bounded (Const a b)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Const

Methods

minBound :: Const a b #

maxBound :: Const a b #

Enum a => Enum (Const a b)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Const

Methods

succ :: Const a b -> Const a b #

pred :: Const a b -> Const a b #

toEnum :: Int -> Const a b #

fromEnum :: Const a b -> Int #

enumFrom :: Const a b -> [Const a b] #

enumFromThen :: Const a b -> Const a b -> [Const a b] #

enumFromTo :: Const a b -> Const a b -> [Const a b] #

enumFromThenTo :: Const a b -> Const a b -> Const a b -> [Const a b] #

Floating a => Floating (Const a b)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Const

Methods

pi :: Const a b #

exp :: Const a b -> Const a b #

log :: Const a b -> Const a b #

sqrt :: Const a b -> Const a b #

(**) :: Const a b -> Const a b -> Const a b #

logBase :: Const a b -> Const a b -> Const a b #

sin :: Const a b -> Const a b #

cos :: Const a b -> Const a b #

tan :: Const a b -> Const a b #

asin :: Const a b -> Const a b #

acos :: Const a b -> Const a b #

atan :: Const a b -> Const a b #

sinh :: Const a b -> Const a b #

cosh :: Const a b -> Const a b #

tanh :: Const a b -> Const a b #

asinh :: Const a b -> Const a b #

acosh :: Const a b -> Const a b #

atanh :: Const a b -> Const a b #

log1p :: Const a b -> Const a b #

expm1 :: Const a b -> Const a b #

log1pexp :: Const a b -> Const a b #

log1mexp :: Const a b -> Const a b #

RealFloat a => RealFloat (Const a b)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Const

Methods

floatRadix :: Const a b -> Integer #

floatDigits :: Const a b -> Int #

floatRange :: Const a b -> (Int, Int) #

decodeFloat :: Const a b -> (Integer, Int) #

encodeFloat :: Integer -> Int -> Const a b #

exponent :: Const a b -> Int #

significand :: Const a b -> Const a b #

scaleFloat :: Int -> Const a b -> Const a b #

isNaN :: Const a b -> Bool #

isInfinite :: Const a b -> Bool #

isDenormalized :: Const a b -> Bool #

isNegativeZero :: Const a b -> Bool #

isIEEE :: Const a b -> Bool #

atan2 :: Const a b -> Const a b -> Const a b #

Generic (Const a b) 
Instance details

Defined in Data.Functor.Const

Associated Types

type Rep (Const a b) :: Type -> Type #

Methods

from :: Const a b -> Rep (Const a b) x #

to :: Rep (Const a b) x -> Const a b #

Ix a => Ix (Const a b)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Const

Methods

range :: (Const a b, Const a b) -> [Const a b] #

index :: (Const a b, Const a b) -> Const a b -> Int #

unsafeIndex :: (Const a b, Const a b) -> Const a b -> Int #

inRange :: (Const a b, Const a b) -> Const a b -> Bool #

rangeSize :: (Const a b, Const a b) -> Int #

unsafeRangeSize :: (Const a b, Const a b) -> Int #

Num a => Num (Const a b)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Const

Methods

(+) :: Const a b -> Const a b -> Const a b #

(-) :: Const a b -> Const a b -> Const a b #

(*) :: Const a b -> Const a b -> Const a b #

negate :: Const a b -> Const a b #

abs :: Const a b -> Const a b #

signum :: Const a b -> Const a b #

fromInteger :: Integer -> Const a b #

Read a => Read (Const a b)

This instance would be equivalent to the derived instances of the Const newtype if the getConst field were removed

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Const

Fractional a => Fractional (Const a b)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Const

Methods

(/) :: Const a b -> Const a b -> Const a b #

recip :: Const a b -> Const a b #

fromRational :: Rational -> Const a b #

Integral a => Integral (Const a b)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Const

Methods

quot :: Const a b -> Const a b -> Const a b #

rem :: Const a b -> Const a b -> Const a b #

div :: Const a b -> Const a b -> Const a b #

mod :: Const a b -> Const a b -> Const a b #

quotRem :: Const a b -> Const a b -> (Const a b, Const a b) #

divMod :: Const a b -> Const a b -> (Const a b, Const a b) #

toInteger :: Const a b -> Integer #

Real a => Real (Const a b)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Const

Methods

toRational :: Const a b -> Rational #

RealFrac a => RealFrac (Const a b)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Const

Methods

properFraction :: Integral b0 => Const a b -> (b0, Const a b) #

truncate :: Integral b0 => Const a b -> b0 #

round :: Integral b0 => Const a b -> b0 #

ceiling :: Integral b0 => Const a b -> b0 #

floor :: Integral b0 => Const a b -> b0 #

Show a => Show (Const a b)

This instance would be equivalent to the derived instances of the Const newtype if the getConst field were removed

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Const

Methods

showsPrec :: Int -> Const a b -> ShowS #

show :: Const a b -> String #

showList :: [Const a b] -> ShowS #

Eq a => Eq (Const a b)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Const

Methods

(==) :: Const a b -> Const a b -> Bool #

(/=) :: Const a b -> Const a b -> Bool #

Ord a => Ord (Const a b)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Const

Methods

compare :: Const a b -> Const a b -> Ordering #

(<) :: Const a b -> Const a b -> Bool #

(<=) :: Const a b -> Const a b -> Bool #

(>) :: Const a b -> Const a b -> Bool #

(>=) :: Const a b -> Const a b -> Bool #

max :: Const a b -> Const a b -> Const a b #

min :: Const a b -> Const a b -> Const a b #

Hashable a => Hashable (Const a b) 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Const a b -> Int #

hash :: Const a b -> Int #

Monoid a => Monoid (Const a b) Source # 
Instance details

Defined in Data.Monoid.Linear.Internal.Monoid

Methods

mempty :: Const a b Source #

Semigroup a => Semigroup (Const a b) Source # 
Instance details

Defined in Data.Monoid.Linear.Internal.Semigroup

Methods

(<>) :: Const a b %1 -> Const a b %1 -> Const a b Source #

type Rep1 (Const a :: k -> Type)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Const

type Rep1 (Const a :: k -> Type) = D1 ('MetaData "Const" "Data.Functor.Const" "base" 'True) (C1 ('MetaCons "Const" 'PrefixI 'True) (S1 ('MetaSel ('Just "getConst") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))
type Rep1 (Const a :: k -> Type) 
Instance details

Defined in Generics.Linear.Instances.Base

type Rep1 (Const a :: k -> Type) = D1 ('MetaData "Const" "Data.Functor.Const" "base" 'True) (C1 ('MetaCons "Const" 'PrefixI 'True) (S1 ('MetaSel ('Just "getConst") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))
type Rep (Const a b)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Const

type Rep (Const a b) = D1 ('MetaData "Const" "Data.Functor.Const" "base" 'True) (C1 ('MetaCons "Const" 'PrefixI 'True) (S1 ('MetaSel ('Just "getConst") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))
type Rep (Const a b) 
Instance details

Defined in Generics.Linear.Instances.Base

type Rep (Const a b) = D1 ('MetaData "Const" "Data.Functor.Const" "base" 'True) (C1 ('MetaCons "Const" 'PrefixI 'True) (S1 ('MetaSel ('Just "getConst") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))

Linear traversable hierarchy

class Functor t => Traversable t where Source #

A linear data traversible is a functor of type t a where you can apply a linear effectful action of type a %1-> f b on each value of type a and compose this to perform an action on the whole functor, resulting in a value of type f (t b).

To learn more about Traversable, see here:

Minimal complete definition

traverse | sequence

Methods

traverse :: Applicative f => (a %1 -> f b) -> t a %1 -> f (t b) Source #

sequence :: Applicative f => t (f a) %1 -> f (t a) Source #

Instances

Instances details
Traversable Par1 Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Traversable

Methods

traverse :: Applicative f => (a %1 -> f b) -> Par1 a %1 -> f (Par1 b) Source #

sequence :: Applicative f => Par1 (f a) %1 -> f (Par1 a) Source #

Traversable Maybe Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Traversable

Methods

traverse :: Applicative f => (a %1 -> f b) -> Maybe a %1 -> f (Maybe b) Source #

sequence :: Applicative f => Maybe (f a) %1 -> f (Maybe a) Source #

Traversable [] Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Traversable

Methods

traverse :: Applicative f => (a %1 -> f b) -> [a] %1 -> f [b] Source #

sequence :: Applicative f => [f a] %1 -> f [a] Source #

Traversable (Either a) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Traversable

Methods

traverse :: Applicative f => (a0 %1 -> f b) -> Either a a0 %1 -> f (Either a b) Source #

sequence :: Applicative f => Either a (f a0) %1 -> f (Either a a0) Source #

Traversable (U1 :: Type -> Type) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Traversable

Methods

traverse :: Applicative f => (a %1 -> f b) -> U1 a %1 -> f (U1 b) Source #

sequence :: Applicative f => U1 (f a) %1 -> f (U1 a) Source #

Traversable (UAddr :: Type -> Type) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Traversable

Methods

traverse :: Applicative f => (a %1 -> f b) -> UAddr a %1 -> f (UAddr b) Source #

sequence :: Applicative f => UAddr (f a) %1 -> f (UAddr a) Source #

Traversable (UChar :: Type -> Type) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Traversable

Methods

traverse :: Applicative f => (a %1 -> f b) -> UChar a %1 -> f (UChar b) Source #

sequence :: Applicative f => UChar (f a) %1 -> f (UChar a) Source #

Traversable (UDouble :: Type -> Type) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Traversable

Methods

traverse :: Applicative f => (a %1 -> f b) -> UDouble a %1 -> f (UDouble b) Source #

sequence :: Applicative f => UDouble (f a) %1 -> f (UDouble a) Source #

Traversable (UFloat :: Type -> Type) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Traversable

Methods

traverse :: Applicative f => (a %1 -> f b) -> UFloat a %1 -> f (UFloat b) Source #

sequence :: Applicative f => UFloat (f a) %1 -> f (UFloat a) Source #

Traversable (UInt :: Type -> Type) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Traversable

Methods

traverse :: Applicative f => (a %1 -> f b) -> UInt a %1 -> f (UInt b) Source #

sequence :: Applicative f => UInt (f a) %1 -> f (UInt a) Source #

Traversable (UWord :: Type -> Type) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Traversable

Methods

traverse :: Applicative f => (a %1 -> f b) -> UWord a %1 -> f (UWord b) Source #

sequence :: Applicative f => UWord (f a) %1 -> f (UWord a) Source #

Traversable (V1 :: Type -> Type) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Traversable

Methods

traverse :: Applicative f => (a %1 -> f b) -> V1 a %1 -> f (V1 b) Source #

sequence :: Applicative f => V1 (f a) %1 -> f (V1 a) Source #

KnownNat n => Traversable (V n) Source # 
Instance details

Defined in Data.V.Linear.Internal.Instances

Methods

traverse :: Applicative f => (a %1 -> f b) -> V n a %1 -> f (V n b) Source #

sequence :: Applicative f => V n (f a) %1 -> f (V n a) Source #

Traversable ((,) a) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Traversable

Methods

traverse :: Applicative f => (a0 %1 -> f b) -> (a, a0) %1 -> f (a, b) Source #

sequence :: Applicative f => (a, f a0) %1 -> f (a, a0) Source #

Traversable (Const a :: Type -> Type) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Traversable

Methods

traverse :: Applicative f => (a0 %1 -> f b) -> Const a a0 %1 -> f (Const a b) Source #

sequence :: Applicative f => Const a (f a0) %1 -> f (Const a a0) Source #

Traversable ((,,) a b) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Traversable

Methods

traverse :: Applicative f => (a0 %1 -> f b0) -> (a, b, a0) %1 -> f (a, b, b0) Source #

sequence :: Applicative f => (a, b, f a0) %1 -> f (a, b, a0) Source #

(Traversable f, Traversable g) => Traversable (f :*: g) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Traversable

Methods

traverse :: Applicative f0 => (a %1 -> f0 b) -> (f :*: g) a %1 -> f0 ((f :*: g) b) Source #

sequence :: Applicative f0 => (f :*: g) (f0 a) %1 -> f0 ((f :*: g) a) Source #

(Traversable f, Traversable g) => Traversable (f :+: g) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Traversable

Methods

traverse :: Applicative f0 => (a %1 -> f0 b) -> (f :+: g) a %1 -> f0 ((f :+: g) b) Source #

sequence :: Applicative f0 => (f :+: g) (f0 a) %1 -> f0 ((f :+: g) a) Source #

Traversable (K1 i v :: Type -> Type) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Traversable

Methods

traverse :: Applicative f => (a %1 -> f b) -> K1 i v a %1 -> f (K1 i v b) Source #

sequence :: Applicative f => K1 i v (f a) %1 -> f (K1 i v a) Source #

Traversable ((,,,) a b c) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Traversable

Methods

traverse :: Applicative f => (a0 %1 -> f b0) -> (a, b, c, a0) %1 -> f (a, b, c, b0) Source #

sequence :: Applicative f => (a, b, c, f a0) %1 -> f (a, b, c, a0) Source #

Traversable f => Traversable (M1 i c f) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Traversable

Methods

traverse :: Applicative f0 => (a %1 -> f0 b) -> M1 i c f a %1 -> f0 (M1 i c f b) Source #

sequence :: Applicative f0 => M1 i c f (f0 a) %1 -> f0 (M1 i c f a) Source #

(Traversable f, Traversable g) => Traversable (f :.: g) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Traversable

Methods

traverse :: Applicative f0 => (a %1 -> f0 b) -> (f :.: g) a %1 -> f0 ((f :.: g) b) Source #

sequence :: Applicative f0 => (f :.: g) (f0 a) %1 -> f0 ((f :.: g) a) Source #

Traversable ((,,,,) a b c d) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Traversable

Methods

traverse :: Applicative f => (a0 %1 -> f b0) -> (a, b, c, d, a0) %1 -> f (a, b, c, d, b0) Source #

sequence :: Applicative f => (a, b, c, d, f a0) %1 -> f (a, b, c, d, a0) Source #

genericTraverse :: (Generic1 t, GTraversable (Rep1 t), Applicative f) => (a %1 -> f b) -> t a %1 -> f (t b) Source #

Implementation of traverse for types which derive (linear) Generic1.

### Performance note

At present, this function does not perform well for recursive types like lists; it will not specialize to either

### Example

data T
$(deriveGeneric1 ''T)

instance Traversable T where
  traverse = genericTraverse

Note that, contrary to many other classes in linear-base, we can't define `Traversable T` using deriving via, because the role of t, in the type of traverse, is nominal.

class GTraversable t Source #

This type class derives the definition of genericTraverse by induction on the generic representation of a type.

Minimal complete definition

gtraverse

Instances

Instances details
GTraversable Par1 Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Traversable

Methods

gtraverse :: Applicative f => (a %1 -> f b) -> Par1 a %1 -> Curried (Yoneda f) (Yoneda f) (Par1 b)

GTraversable (U1 :: TYPE LiftedRep -> Type) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Traversable

Methods

gtraverse :: Applicative f => (a %1 -> f b) -> U1 a %1 -> Curried (Yoneda f) (Yoneda f) (U1 b)

GTraversable (UAddr :: TYPE LiftedRep -> Type) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Traversable

Methods

gtraverse :: Applicative f => (a %1 -> f b) -> UAddr a %1 -> Curried (Yoneda f) (Yoneda f) (UAddr b)

GTraversable (UChar :: TYPE LiftedRep -> Type) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Traversable

Methods

gtraverse :: Applicative f => (a %1 -> f b) -> UChar a %1 -> Curried (Yoneda f) (Yoneda f) (UChar b)

GTraversable (UDouble :: TYPE LiftedRep -> Type) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Traversable

Methods

gtraverse :: Applicative f => (a %1 -> f b) -> UDouble a %1 -> Curried (Yoneda f) (Yoneda f) (UDouble b)

GTraversable (UFloat :: TYPE LiftedRep -> Type) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Traversable

Methods

gtraverse :: Applicative f => (a %1 -> f b) -> UFloat a %1 -> Curried (Yoneda f) (Yoneda f) (UFloat b)

GTraversable (UInt :: TYPE LiftedRep -> Type) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Traversable

Methods

gtraverse :: Applicative f => (a %1 -> f b) -> UInt a %1 -> Curried (Yoneda f) (Yoneda f) (UInt b)

GTraversable (UWord :: TYPE LiftedRep -> Type) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Traversable

Methods

gtraverse :: Applicative f => (a %1 -> f b) -> UWord a %1 -> Curried (Yoneda f) (Yoneda f) (UWord b)

GTraversable (V1 :: TYPE LiftedRep -> Type) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Traversable

Methods

gtraverse :: Applicative f => (a %1 -> f b) -> V1 a %1 -> Curried (Yoneda f) (Yoneda f) (V1 b)

(GTraversable f, GTraversable g) => GTraversable (f :*: g) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Traversable

Methods

gtraverse :: Applicative f0 => (a %1 -> f0 b) -> (f :*: g) a %1 -> Curried (Yoneda f0) (Yoneda f0) ((f :*: g) b)

(GTraversable f, GTraversable g) => GTraversable (f :+: g) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Traversable

Methods

gtraverse :: Applicative f0 => (a %1 -> f0 b) -> (f :+: g) a %1 -> Curried (Yoneda f0) (Yoneda f0) ((f :+: g) b)

GTraversable (K1 i c :: TYPE LiftedRep -> Type) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Traversable

Methods

gtraverse :: Applicative f => (a %1 -> f b) -> K1 i c a %1 -> Curried (Yoneda f) (Yoneda f) (K1 i c b)

(m ~ 'One, GTraversable t) => GTraversable (MP1 m t) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Traversable

Methods

gtraverse :: Applicative f => (a %1 -> f b) -> MP1 m t a %1 -> Curried (Yoneda f) (Yoneda f) (MP1 m t b)

GTraversable t => GTraversable (M1 i c t) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Traversable

Methods

gtraverse :: Applicative f => (a %1 -> f b) -> M1 i c t a %1 -> Curried (Yoneda f) (Yoneda f) (M1 i c t b)

(GTraversable f, Traversable g) => GTraversable (f :.: g) Source # 
Instance details

Defined in Data.Functor.Linear.Internal.Traversable

Methods

gtraverse :: Applicative f0 => (a %1 -> f0 b) -> (f :.: g) a %1 -> Curried (Yoneda f0) (Yoneda f0) ((f :.: g) b)

mapM :: (Traversable t, Monad m) => (a %1 -> m b) -> t a %1 -> m (t b) Source #

sequenceA :: (Traversable t, Applicative f) => t (f a) %1 -> f (t a) Source #

for :: (Traversable t, Applicative f) => t a %1 -> (a %1 -> f b) -> f (t b) Source #

forM :: (Traversable t, Monad m) => t a %1 -> (a %1 -> m b) -> m (t b) Source #

mapAccumL :: Traversable t => (a %1 -> b %1 -> (a, c)) -> a %1 -> t b %1 -> (a, t c) Source #

mapAccumR :: Traversable t => (a %1 -> b %1 -> (a, c)) -> a %1 -> t b %1 -> (a, t c) Source #