Safe Haskell | None |
---|---|
Language | Haskell2010 |
Data.PTraversable
Contents
Synopsis
- class (Ord1 t, Traversable t) => PTraversable (t :: Type -> Type) where
- ptraverseWith :: (Cartesian p, Cocartesian p) => (as -> t a) -> (t b -> bs) -> p a b -> p as bs
- ptraverse :: (PTraversable t, Cartesian p, Cocartesian p) => p a b -> p (t a) (t b)
- fmapDefault :: PTraversable t => (a -> b) -> t a -> t b
- foldMapDefault :: (PTraversable t, Monoid m) => (a -> m) -> t a -> m
- traverseDefault :: (PTraversable t, Applicative f) => (a -> f b) -> t a -> f (t b)
- eq1Default :: (PTraversable t, Eq a) => t a -> t a -> Bool
- liftEq' :: PTraversable t => (a -> a -> Bool) -> t a -> t a -> Bool
- liftEqDefault :: PTraversable t => (a -> b -> Bool) -> t a -> t b -> Bool
- compare1Default :: (PTraversable t, Ord a) => t a -> t a -> Ordering
- liftCompare' :: PTraversable t => (a -> a -> Ordering) -> t a -> t a -> Ordering
- liftCompareDefault :: PTraversable t => (a -> b -> Ordering) -> t a -> t b -> Ordering
- cardinality1 :: forall (t :: Type -> Type) proxy. PTraversable t => proxy t -> Int -> Int
- enum1 :: (PTraversable t, Alternative f) => f a -> f (t a)
- coenum1 :: (PTraversable t, Divisible f, Decidable f) => f b -> f (t b)
- newtype WrappedPTraversable (t :: Type -> Type) a = WrapPTraversable {
- unwrapPTraversable :: t a
- newtype Generically1 (f :: k -> Type) (a :: k) where
- Generically1 :: forall {k} (f :: k -> Type) (a :: k). f a -> Generically1 f a
- ptraverseDay :: forall (t :: Type -> Type) (u :: Type -> Type) p a b. (PTraversable t, PTraversable u, Cartesian p, Cocartesian p) => p a b -> p (Day t u a) (Day t u b)
- ptraverseDayWith :: forall (t :: Type -> Type) (u :: Type -> Type) p x a b y. (PTraversable t, PTraversable u, Cartesian p, Cocartesian p) => (x -> Day t u a) -> (Day t u b -> y) -> p a b -> p x y
Documentation
class (Ord1 t, Traversable t) => PTraversable (t :: Type -> Type) where Source #
Methods
ptraverseWith :: (Cartesian p, Cocartesian p) => (as -> t a) -> (t b -> bs) -> p a b -> p as bs Source #
Instances
ptraverse :: (PTraversable t, Cartesian p, Cocartesian p) => p a b -> p (t a) (t b) Source #
fmapDefault :: PTraversable t => (a -> b) -> t a -> t b Source #
foldMapDefault :: (PTraversable t, Monoid m) => (a -> m) -> t a -> m Source #
traverseDefault :: (PTraversable t, Applicative f) => (a -> f b) -> t a -> f (t b) Source #
Default equality and comparison
eq1Default :: (PTraversable t, Eq a) => t a -> t a -> Bool Source #
liftEq' :: PTraversable t => (a -> a -> Bool) -> t a -> t a -> Bool Source #
Type-restricted version of liftEq
.
liftEq :: forall t a b. (Eq1 t) => (a -> b -> Bool) -> t a -> t b -> Bool liftEq' :: forall t a. (.....) => (a -> a -> Bool) -> t a -> t a -> Bool
liftEqDefault :: PTraversable t => (a -> b -> Bool) -> t a -> t b -> Bool Source #
compare1Default :: (PTraversable t, Ord a) => t a -> t a -> Ordering Source #
liftCompare' :: PTraversable t => (a -> a -> Ordering) -> t a -> t a -> Ordering Source #
Type-restricted version of liftCompare
.
liftEq :: forall t a b. (Eq1 t) => (a -> b -> Bool) -> t a -> t b -> Bool liftEq' :: forall t a. (.....) => (a -> a -> Bool) -> t a -> t a -> Bool
liftCompareDefault :: PTraversable t => (a -> b -> Ordering) -> t a -> t b -> Ordering Source #
cardinality1 :: forall (t :: Type -> Type) proxy. PTraversable t => proxy t -> Int -> Int Source #
enum1 :: (PTraversable t, Alternative f) => f a -> f (t a) Source #
newtype WrappedPTraversable (t :: Type -> Type) a Source #
Constructors
WrapPTraversable | |
Fields
|
Instances
newtype Generically1 (f :: k -> Type) (a :: k) where #
A type whose instances are defined generically, using the
Generic1
representation. Generically1
is a higher-kinded
version of Generically
that uses Generic
.
Generic instances can be derived for type constructors via
using Generically1
F-XDerivingVia
.
{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DerivingStrategies #-} {-# LANGUAGE DerivingVia #-} import GHC.Generics (Generic) data V4 a = V4 a a a a deriving stock (Functor, Generic1) deriving Applicative via Generically1 V4
This corresponds to Applicative
instances defined by pointwise
lifting:
instance Applicative V4 where pure :: a -> V4 a pure a = V4 a a a a liftA2 :: (a -> b -> c) -> (V4 a -> V4 b -> V4 c) liftA2 (·) (V4 a1 b1 c1 d1) (V4 a2 b2 c2 d2) = V4 (a1 · a2) (b1 · b2) (c1 · c2) (d1 · d2)
Historically this required modifying the type class to include
generic method definitions (-XDefaultSignatures
) and deriving it
with the anyclass
strategy (-XDeriveAnyClass
). Having a /via
type/ like Generically1
decouples the instance from the type
class.
Since: base-4.17.0.0
Constructors
Generically1 :: forall {k} (f :: k -> Type) (a :: k). f a -> Generically1 f a |
Instances
ptraverseDay :: forall (t :: Type -> Type) (u :: Type -> Type) p a b. (PTraversable t, PTraversable u, Cartesian p, Cocartesian p) => p a b -> p (Day t u a) (Day t u b) Source #
Day
lacks various instances required to be PTraversable
ptraverseDayWith :: forall (t :: Type -> Type) (u :: Type -> Type) p x a b y. (PTraversable t, PTraversable u, Cartesian p, Cocartesian p) => (x -> Day t u a) -> (Day t u b -> y) -> p a b -> p x y Source #