strongweak-0.6.0: Convert between strong and weak representations of types
Safe HaskellSafe-Inferred
LanguageGHC2021

Strongweak.Generic.Weaken

Description

weaken over generic representations.

Synopsis

Documentation

weakenGeneric :: (Generic s, Generic w, GWeaken (Rep s) (Rep w)) => s -> w Source #

Weaken a value generically.

The weak and strong types must be compatible. See Generic for the definition of compatibility in this context.

class GWeaken s w where Source #

Methods

gweaken :: s p -> w p Source #

Instances

Instances details
GWeaken (U1 :: k -> Type) (U1 :: k -> Type) Source #

Nothing to do for empty constructors.

Instance details

Defined in Strongweak.Generic.Weaken

Methods

gweaken :: forall (p :: k0). U1 p -> U1 p Source #

GWeaken (V1 :: k -> Type) (V1 :: k -> Type) Source #

Nothing to do for empty datatypes.

Instance details

Defined in Strongweak.Generic.Weaken

Methods

gweaken :: forall (p :: k0). V1 p -> V1 p Source #

GWeaken (Rec0 s :: k -> Type) (Rec0 s :: k -> Type) Source #

Special case: if source and target types are equal, copy the value through.

Instance details

Defined in Strongweak.Generic.Weaken

Methods

gweaken :: forall (p :: k0). Rec0 s p -> Rec0 s p Source #

(Weaken s, Weak s ~ w) => GWeaken (Rec0 s :: k -> Type) (Rec0 w :: k -> Type) Source #

Weaken a field using the existing Weaken instance.

Instance details

Defined in Strongweak.Generic.Weaken

Methods

gweaken :: forall (p :: k0). Rec0 s p -> Rec0 w p Source #

(GWeaken ls lw, GWeaken rs rw) => GWeaken (ls :*: rs :: k -> Type) (lw :*: rw :: k -> Type) Source #

Weaken product types by weakening left and right.

Instance details

Defined in Strongweak.Generic.Weaken

Methods

gweaken :: forall (p :: k0). (ls :*: rs) p -> (lw :*: rw) p Source #

(GWeaken ls lw, GWeaken rs rw) => GWeaken (ls :+: rs :: k -> Type) (lw :+: rw :: k -> Type) Source #

Weaken sum types by casing and weakening left or right.

Instance details

Defined in Strongweak.Generic.Weaken

Methods

gweaken :: forall (p :: k0). (ls :+: rs) p -> (lw :+: rw) p Source #

GWeaken s w => GWeaken (M1 is ms s :: k -> Type) (M1 iw mw w :: k -> Type) Source #

Strip all meta.

Instance details

Defined in Strongweak.Generic.Weaken

Methods

gweaken :: forall (p :: k0). M1 is ms s p -> M1 iw mw w p Source #