Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- enumerate :: (Traversable t, Num ix) => t a -> t (ix, a)
- size :: (Foldable t, Num size) => t a -> size
- toVector :: Foldable collection => collection a -> Vector a
- toVectorStorable :: (Foldable collection, Storable a) => collection a -> Vector a
- class Generic1 (f :: k -> Type)
- newtype Generically1 (f :: k -> Type) (a :: k) where
- Generically1 :: forall {k} (f :: k -> Type) (a :: k). f a -> Generically1 f a
Documentation
enumerate :: (Traversable t, Num ix) => t a -> t (ix, a) Source #
class Generic1 (f :: k -> Type) #
Representable types of kind * -> *
(or kind k -> *
, when PolyKinds
is enabled).
This class is derivable in GHC with the DeriveGeneric
flag on.
A Generic1
instance must satisfy the following laws:
from1
.to1
≡id
to1
.from1
≡id
Instances
Generic1 ZipList | |
Generic1 Complex | |
Generic1 Identity | |
Generic1 First | |
Generic1 Last | |
Generic1 Down | |
Generic1 First | |
Generic1 Last | |
Generic1 Max | |
Generic1 Min | |
Generic1 WrappedMonoid | |
Defined in Data.Semigroup type Rep1 WrappedMonoid :: k -> Type # from1 :: forall (a :: k). WrappedMonoid a -> Rep1 WrappedMonoid a # to1 :: forall (a :: k). Rep1 WrappedMonoid a -> WrappedMonoid a # | |
Generic1 Dual | |
Generic1 Product | |
Generic1 Sum | |
Generic1 Par1 | |
Generic1 Digit | |
Generic1 Elem | |
Generic1 FingerTree | |
Defined in Data.Sequence.Internal type Rep1 FingerTree :: k -> Type # from1 :: forall (a :: k). FingerTree a -> Rep1 FingerTree a # to1 :: forall (a :: k). Rep1 FingerTree a -> FingerTree a # | |
Generic1 Node | |
Generic1 ViewL | |
Generic1 ViewR | |
Generic1 Tree | |
Generic1 Stages Source # | |
Generic1 Stages Source # | |
Generic1 Stages Source # | |
Generic1 Collection Source # | |
Defined in Engine.Window.MouseButton type Rep1 Collection :: k -> Type # from1 :: forall (a :: k). Collection a -> Rep1 Collection a # to1 :: forall (a :: k). Rep1 Collection a -> Collection a # | |
Generic1 Collection Source # | |
Defined in Render.Samplers type Rep1 Collection :: k -> Type # from1 :: forall (a :: k). Collection a -> Rep1 Collection a # to1 :: forall (a :: k). Rep1 Collection a -> Collection a # | |
Generic1 Maybe | |
Generic1 NonEmpty | |
Generic1 Maybe | |
Generic1 Solo | |
Generic1 [] | |
Generic1 (WrappedMonad m :: Type -> Type) | |
Defined in Control.Applicative type Rep1 (WrappedMonad m) :: k -> Type # from1 :: forall (a :: k). WrappedMonad m a -> Rep1 (WrappedMonad m) a # to1 :: forall (a :: k). Rep1 (WrappedMonad m) a -> WrappedMonad m a # | |
Generic1 (Either a :: Type -> Type) | |
Generic1 (Arg a :: Type -> Type) | |
Generic1 (Either a :: Type -> Type) | |
Generic1 (These a :: Type -> Type) | |
Generic1 (Pair a :: Type -> Type) | |
Generic1 (These a :: Type -> Type) | |
Generic1 ((,) a :: Type -> Type) | |
Generic1 (Proxy :: k -> Type) | |
Generic1 (U1 :: k -> Type) | |
Generic1 (V1 :: k -> Type) | |
Generic1 (WrappedArrow a b :: Type -> Type) | |
Defined in Control.Applicative type Rep1 (WrappedArrow a b) :: k -> Type # from1 :: forall (a0 :: k). WrappedArrow a b a0 -> Rep1 (WrappedArrow a b) a0 # to1 :: forall (a0 :: k). Rep1 (WrappedArrow a b) a0 -> WrappedArrow a b a0 # | |
Generic1 (Kleisli m a :: Type -> Type) | |
Generic1 (Tagged s :: Type -> Type) | |
Generic1 ((,,) a b :: Type -> Type) | |
Generic1 (Const a :: k -> Type) | |
Generic1 (Ap f :: k -> Type) | |
Generic1 (Alt f :: k -> Type) | |
Generic1 (Rec1 f :: k -> Type) | |
Generic1 (URec (Ptr ()) :: k -> Type) | |
Generic1 (URec Char :: k -> Type) | |
Generic1 (URec Double :: k -> Type) | |
Generic1 (URec Float :: k -> Type) | |
Generic1 (URec Int :: k -> Type) | |
Generic1 (URec Word :: k -> Type) | |
Generic1 ((,,,) a b c :: Type -> Type) | |
Generic1 (Product f g :: k -> Type) | |
Generic1 (Sum f g :: k -> Type) | |
Generic1 (f :*: g :: k -> Type) | |
Generic1 (f :+: g :: k -> Type) | |
Generic1 (K1 i c :: k -> Type) | |
Generic1 ((,,,,) a b c d :: Type -> Type) | |
Functor f => Generic1 (Compose f g :: k -> Type) | |
Functor f => Generic1 (f :.: g :: k -> Type) | |
Generic1 (M1 i c f :: k -> Type) | |
Generic1 (Clown f a :: k1 -> Type) | |
Generic1 (Joker g a :: k1 -> Type) | |
Generic1 (WrappedBifunctor p a :: k1 -> Type) | |
Defined in Data.Bifunctor.Wrapped type Rep1 (WrappedBifunctor p a) :: k -> Type # from1 :: forall (a0 :: k). WrappedBifunctor p a a0 -> Rep1 (WrappedBifunctor p a) a0 # to1 :: forall (a0 :: k). Rep1 (WrappedBifunctor p a) a0 -> WrappedBifunctor p a a0 # | |
Generic1 ((,,,,,) a b c d e :: Type -> Type) | |
Generic1 (Product f g a :: k1 -> Type) | |
Generic1 (Sum p q a :: k1 -> Type) | |
Generic1 ((,,,,,,) a b c d e f :: Type -> Type) | |
Functor f => Generic1 (Tannen f p a :: k2 -> Type) | |
Generic1 ((,,,,,,,) a b c d e f g :: Type -> Type) | |
Generic1 ((,,,,,,,,) a b c d e f g h :: Type -> Type) | |
Defined in GHC.Generics type Rep1 ((,,,,,,,,) a b c d e f g h) :: k -> Type # from1 :: forall (a0 :: k). (a, b, c, d, e, f, g, h, a0) -> Rep1 ((,,,,,,,,) a b c d e f g h) a0 # to1 :: forall (a0 :: k). Rep1 ((,,,,,,,,) a b c d e f g h) a0 -> (a, b, c, d, e, f, g, h, a0) # | |
Functor (p (f a)) => Generic1 (Biff p f g a :: k3 -> Type) | |
Generic1 ((,,,,,,,,,) a b c d e f g h i :: Type -> Type) | |
Defined in GHC.Generics type Rep1 ((,,,,,,,,,) a b c d e f g h i) :: k -> Type # from1 :: forall (a0 :: k). (a, b, c, d, e, f, g, h, i, a0) -> Rep1 ((,,,,,,,,,) a b c d e f g h i) a0 # to1 :: forall (a0 :: k). Rep1 ((,,,,,,,,,) a b c d e f g h i) a0 -> (a, b, c, d, e, f, g, h, i, a0) # | |
Generic1 ((,,,,,,,,,,) a b c d e f g h i j :: Type -> Type) | |
Defined in GHC.Generics type Rep1 ((,,,,,,,,,,) a b c d e f g h i j) :: k -> Type # from1 :: forall (a0 :: k). (a, b, c, d, e, f, g, h, i, j, a0) -> Rep1 ((,,,,,,,,,,) a b c d e f g h i j) a0 # to1 :: forall (a0 :: k). Rep1 ((,,,,,,,,,,) a b c d e f g h i j) a0 -> (a, b, c, d, e, f, g, h, i, j, a0) # | |
Generic1 ((,,,,,,,,,,,) a b c d e f g h i j k :: Type -> Type) | |
Defined in GHC.Generics type Rep1 ((,,,,,,,,,,,) a b c d e f g h i j k) :: k -> Type # from1 :: forall (a0 :: k0). (a, b, c, d, e, f, g, h, i, j, k, a0) -> Rep1 ((,,,,,,,,,,,) a b c d e f g h i j k) a0 # to1 :: forall (a0 :: k0). Rep1 ((,,,,,,,,,,,) a b c d e f g h i j k) a0 -> (a, b, c, d, e, f, g, h, i, j, k, a0) # | |
Generic1 ((,,,,,,,,,,,,) a b c d e f g h i j k l :: Type -> Type) | |
Defined in GHC.Generics type Rep1 ((,,,,,,,,,,,,) a b c d e f g h i j k l) :: k -> Type # from1 :: forall (a0 :: k0). (a, b, c, d, e, f, g, h, i, j, k, l, a0) -> Rep1 ((,,,,,,,,,,,,) a b c d e f g h i j k l) a0 # to1 :: forall (a0 :: k0). Rep1 ((,,,,,,,,,,,,) a b c d e f g h i j k l) a0 -> (a, b, c, d, e, f, g, h, i, j, k, l, a0) # | |
Generic1 ((,,,,,,,,,,,,,) a b c d e f g h i j k l m :: Type -> Type) | |
Defined in GHC.Generics type Rep1 ((,,,,,,,,,,,,,) a b c d e f g h i j k l m) :: k -> Type # from1 :: forall (a0 :: k0). (a, b, c, d, e, f, g, h, i, j, k, l, m, a0) -> Rep1 ((,,,,,,,,,,,,,) a b c d e f g h i j k l m) a0 # to1 :: forall (a0 :: k0). Rep1 ((,,,,,,,,,,,,,) a b c d e f g h i j k l m) a0 -> (a, b, c, d, e, f, g, h, i, j, k, l, m, a0) # | |
Generic1 ((,,,,,,,,,,,,,,) a b c d e f g h i j k l m n :: Type -> Type) | |
Defined in GHC.Generics type Rep1 ((,,,,,,,,,,,,,,) a b c d e f g h i j k l m n) :: k -> Type # from1 :: forall (a0 :: k0). (a, b, c, d, e, f, g, h, i, j, k, l, m, n, a0) -> Rep1 ((,,,,,,,,,,,,,,) a b c d e f g h i j k l m n) a0 # to1 :: forall (a0 :: k0). Rep1 ((,,,,,,,,,,,,,,) a b c d e f g h i j k l m n) a0 -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n, a0) # |
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
Generically1 :: forall {k} (f :: k -> Type) (a :: k). f a -> Generically1 f a |