Box
Most users won't need Box, it is used for:
- Holding unknown Roc types when developing platforms.
- To improve performance in rare cases.
box : a -> Box a
Allocates a value on the heap. Boxing is an expensive process as it copies the value from the stack to the heap. This may provide a performance optimization for advanced use cases with large values. A platform may require that some values are boxed.
expect Box.unbox (Box.box "Stack Faster") == "Stack Faster"
unbox : Box a -> a
Returns a boxed value.
expect Box.unbox (Box.box "Stack Faster") == "Stack Faster"