Safe Haskell | None |
---|---|
Language | GHC2021 |
Strongweak.Strength
Description
Definitions using a type-level strength switch.
Documentation
Strength enumeration: it's either strong, or weak.
Primarily interesting at the type level (using DataKinds).
type family SW (s :: Strength) a where ... Source #
Get either the strong or weak representation of a type, depending on the type-level "switch" provided.
This is intended to be used in data types that take a Strength
type. Define
your type using strong fields wrapped in SW s
. You then get the weak
representation for free, using the same definition.
data A (s :: Strength) = A { a1 :: SW s Word8 , a2 :: String }