@hackage strongweak0.1.0
Convert between strong and weak representations of types
Installation
Tested Compilers
Dependencies (5)
- base >=4.14 && <5
- prettyprinter >=1.7.1 && <1.8
- refined >=0.6.3 && <0.7
- validation >=1.1.2 && <1.2
- vector-sized >=1.5.0 && <1.6 Show all…
Dependents (3)
@hackage/binrep, @hackage/binrep-instances, @hackage/gtvm-hs
strongweak
Definitions for transforming between types.
strong -> weakdrops invariants (e.g. going from a bounded to an unbounded numeric type)weak -> Maybe strongintroduces invariants
This is not a Convertible library that enumerates transformations between
types into a dictionary.
- A "strong" type has exactly one "weak" representation.
- Weakening a type is safe.
- Strengthening a type may fail.
There are generic derivers for generating Strengthen and Weaken instances
for arbitrary data types. The Strengthen instances annotate errors
extensively, telling you the datatype & record for which strengthening failed -
recursively, for nested types.
This is a validation library. We don't fail on the first error -- we attempt to
validate every part of a data type, and collate the errors into a list. This
happens magically in the generic deriver, but if you're writing your own
instances, you may want ApplicativeDo so you can use do notation. So it'll
monadic, but actually everything will get checked.