Safe Haskell | None |
---|---|
Language | GHC2021 |
Weaken
class
Weaken some a
, relaxing certain invariants.
See Strongweak for class design notes and laws.
Instances
Weaken Int16 Source # | |||||
Weaken Int32 Source # | |||||
Weaken Int64 Source # | |||||
Weaken Int8 Source # | |||||
Weaken Word16 Source # | |||||
Weaken Word32 Source # | |||||
Weaken Word64 Source # | |||||
Weaken Word8 Source # | |||||
Weaken (Identity a) Source # | Strip wrapper. | ||||
Weaken (NonEmpty a) Source # | Weaken non-empty lists into plain lists. | ||||
Weaken a => Weaken [a] Source # | Decomposer. Weaken every element in a list. | ||||
Defined in Strongweak.Weaken
| |||||
(Weaken a, Weaken b) => Weaken (Either a b) Source # | Decomposer. Weaken either side of an | ||||
(Generic s, Generic w, GWeaken (Rep s) (Rep w)) => Weaken (GenericallySW s w) Source # | |||||
Defined in Strongweak.Generic
weaken :: GenericallySW s w -> Weak (GenericallySW s w) Source # | |||||
(Weaken a, Weaken b) => Weaken (a, b) Source # | Decomposer. Weaken both elements of a tuple. | ||||
Defined in Strongweak.Weaken
| |||||
Weaken (Const a b) Source # | Strip wrapper. | ||||
Weaken (Refined p a) Source # | Strip refined type refinement. | ||||
Vector v a => Weaken (Vector v n a) Source # | Weaken sized vectors into plain lists. | ||||
Weaken (Refined1 p f a) Source # | Strip refined functor type refinement. | ||||
liftWeakF :: Weaken a => (Weak a -> b) -> a -> b Source #
Lift a function on a weak type to the associated strong type by weakening first.
Strength switch helper
Strength enumeration: is it 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 }