| Safe Haskell | Safe-Inferred |
|---|---|
| Language | GHC2021 |
Strongweak.Generic.Via
Synopsis
- newtype GenericallySW s (w :: Type) = GenericallySW {
- unGenericallySW :: s
Documentation
newtype GenericallySW s (w :: Type) Source #
DerivingVia wrapper for strongweak instances.
We can't use Generically conveniently because we need to talk about two data
types, not one -- we would have to do something like , which is ugly. So we instead define our own adorable little "via type"
here!Generically (Tagged w
s)
Use like so:
data XYZ (s :: Strength) = XYZ
{ xyz1 :: SW s Word8
, xyz2 :: Word8
, xyz3 :: ()
} deriving stock Generic
deriving via (GenericallySW (XYZ 'Strong) (XYZ 'Weak)) instance Weaken (XYZ 'Strong)
deriving via (GenericallySW (XYZ 'Strong) (XYZ 'Weak)) instance Strengthen (XYZ 'Strong)
TODO can't figure out a way around multiple standalone deriving declarations :(
Constructors
| GenericallySW | |
Fields
| |
Instances
| (Generic s, Generic w, GStrengthenD (Rep w) (Rep s), Weaken (GenericallySW s w)) => Strengthen (GenericallySW s w) Source # | |
Defined in Strongweak.Generic.Via Methods strengthen :: Weak (GenericallySW s w) -> Result (GenericallySW s w) Source # | |
| (Generic s, Generic w, GWeaken (Rep s) (Rep w)) => Weaken (GenericallySW s w) Source # | |
Defined in Strongweak.Generic.Via Associated Types type Weak (GenericallySW s w) Source # Methods weaken :: GenericallySW s w -> Weak (GenericallySW s w) Source # | |
| type Weak (GenericallySW s w) Source # | |
Defined in Strongweak.Generic.Via | |