strongweak-0.11.0: Convert between strong and weak representations of types
Safe HaskellNone
LanguageGHC2021

Strongweak.Weaken.Generic

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 :: k -> Type) (w :: k -> Type) where Source #

Methods

gweaken :: forall (p :: k). 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.Weaken.Generic

Methods

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

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

Nothing to do for empty datatypes.

Instance details

Defined in Strongweak.Weaken.Generic

Methods

gweaken :: forall (p :: k). 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.Weaken.Generic

Methods

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

(Weaken s, Weakened 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.Weaken.Generic

Methods

gweaken :: forall (p :: k). 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.Weaken.Generic

Methods

gweaken :: forall (p :: k). (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.Weaken.Generic

Methods

gweaken :: forall (p :: k). (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.Weaken.Generic

Methods

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