unsafe package:constraints
Unsafe utilities used throughout constraints. As the names
suggest, these functions are unsafe in general and can cause your
program to segfault if used improperly. Handle with care.
Unsafely create a dictionary for any constraint.
Coerce a dictionary unsafely from one type to another
Coerce a dictionary unsafely from one type to a newtype of that type
Unsafely create an
SChar value directly from a
Char. Use
this function with care:
- The Char value must match the Char c
encoded in the return type SChar c.
- Be wary of using this function to create multiple values of type
SChar T, where T is a type family that does
not reduce (e.g., Any from GHC.Exts). If you do, GHC
is liable to optimize away one of the values and replace it with the
other during a common subexpression elimination pass. If the two
values have different underlying Char values, this could be
disastrous.
Unsafely create an
SNat value directly from a
Natural.
Use this function with care:
- The Natural value must match the Nat n
encoded in the return type SNat n.
- Be wary of using this function to create multiple values of type
SNat T, where T is a type family that does
not reduce (e.g., Any from GHC.Exts). If you do, GHC
is liable to optimize away one of the values and replace it with the
other during a common subexpression elimination pass. If the two
values have different underlying Natural values, this could be
disastrous.
Unsafely create an
SSymbol value directly from a
String.
Use this function with care:
- The String value must match the Symbol s
encoded in the return type SSymbol s.
- Be wary of using this function to create multiple values of type
SSymbol T, where T is a type family that does
not reduce (e.g., Any from GHC.Exts). If you do, GHC
is liable to optimize away one of the values and replace it with the
other during a common subexpression elimination pass. If the two
values have different underlying String values, this could be
disastrous.
Coerce a dictionary unsafely from a newtype of a type to the base type