| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Strongweak.Strengthen.Unsafe
Synopsis
- class Weaken a => UnsafeStrengthen a where
- unsafeStrengthen :: Weak a -> a
Documentation
class Weaken a => UnsafeStrengthen a where Source #
Unsafely transform a to an Weaken aa, without asserting invariants.
For example, you may unsafely strengthen some into
a Natural nWord8 by unsafely coercing the value, ignoring the possibility that n >=
255.
What happens if it turns out you're lying to the computer and your weak value doesn't fit in its strong counterpart? That depends on the strengthen.
- Numeric coercions should safely overflow.
- Some will raise an error (e.g.
NonEmpty). - Others will appear to work, but later explode your computer (sized vectors will probably do this).
Only consider using this if you have a guarantee that your value is safe to treat as strong.
Instances should either handle an invariant, or decompose. See Strongweak for a discussion on this design.
Methods
unsafeStrengthen :: Weak a -> a Source #
Unsafely transform a weak value to its associated strong one.