Safe Haskell | Unsafe |
---|---|
Language | Haskell2010 |
DerivingVia
targets to instantiate Generic
and Generic1
,
both using GHC.Generics.
.Generic
Caution
Synopsis
- newtype GHCGenerically a = GHCGenerically {
- unGHCGenerically :: a
- newtype GHCGenerically1 f a = GHCGenerically1 {
- unGHCGenerically1 :: f a
Documentation
newtype GHCGenerically a Source #
When a
is an instance
of GHC.Generics.
, Generic
GHCGenerically a
is an instance
of Generic
.
Warnings
GHCGenerically
is intended for use as a DerivingVia
target.
Most other uses of its Generic
instance will be quite wrong.
GHCGenerically
must not be used with datatypes that have
nonlinear or linearity-polymorphic fields. Doing so will produce
completely bogus results, breaking the linearity rules.
GHCGenerically
is otherwise safe to use with derived
GHC.Generics.
instances, which are linear. If
you choose to use it with a hand-written instance, you should
check that the underlying instance is linear.Generic
Example
data Foo a = Bar a (Either Int a) | Baz (Maybe a) Int deriving stock (Show, GHC.Generics.Generic
) derivingGeneric
via GHCGenerically (Foo a)
Instances
Generic a => Generic (GHCGenerically a) Source # | |
Defined in Generics.Linear.Unsafe.ViaGHCGenerics to :: forall p (m :: Multiplicity). Rep (GHCGenerically a) p %m -> GHCGenerically a Source # from :: forall p (m :: Multiplicity). GHCGenerically a %m -> Rep (GHCGenerically a) p Source # | |
type Rep (GHCGenerically a) Source # | |
Defined in Generics.Linear.Unsafe.ViaGHCGenerics |
newtype GHCGenerically1 f a Source #
When f a
is an instance of GHC.Generics.
for all Generic
a
, GHCGenerically1 f
is an instance of Generic1
.
Warning
GHCGenerically1
is intended for use as a DerivingVia
target.
Most other uses of its Generic1
instance will be quite wrong.
GHCGenerically1
must not be used with datatypes that have
nonlinear or linearity-polymorphic fields. Doing so will produce
completely bogus results, breaking the linearity rules.
GHCGenerically1
is otherwise safe to use with derived
GHC.Generics.
instances, which are linear. If
you choose to use it with a hand-written instance, you should
check that the underlying instance is linear.Generic
Example
data Foo a = Bar a (Either Int a) | Baz (Maybe a) Int deriving stock (Show, GHC.Generics.Generic
) derivingGeneric1
via GHCGenerically1 Foo
GHCGenerically1 | |
|
Instances
(forall (a :: k). Generic (f a), CheckValid f) => Generic1 (GHCGenerically1 f :: k -> Type) Source # | |
Defined in Generics.Linear.Unsafe.ViaGHCGenerics type Rep1 (GHCGenerically1 f) :: k -> Type Source # to1 :: forall (p :: k0) (m :: Multiplicity). Rep1 (GHCGenerically1 f) p %m -> GHCGenerically1 f p Source # from1 :: forall (p :: k0) (m :: Multiplicity). GHCGenerically1 f p %m -> Rep1 (GHCGenerically1 f) p Source # | |
type Rep1 (GHCGenerically1 f :: k -> Type) Source # | |
Defined in Generics.Linear.Unsafe.ViaGHCGenerics |