std/core/unsafe▲toc

Unsafe primitives to dismiss effects.

.

fun pretend-no-ndet( action : () -> <ndetstd/core/types/ndet: X|e> a ) : e a

Unsafe. This function pretends the given action is deterministic.

fun unsafe-ptr-eq( x : a, y : a ) : boolstd/core/types/bool: V

Unsafe. This function checks if two objects have the same address in the heap. The results may vary on the backend or compiler optimizations but the function pretends to be totalstd/core/types/total: E. Note also that value types always compare unequal since each value will be boxed fresh in the heap when calling this function.

fun unsafe-total( action : () -> e a ) : a

Unsafe. This function calls a function and pretends it did not have any effect at all. Use with utmost care as it should not be used to dismiss user-defined effects that need a handler and can cause a segfault at runtime in such cases!

You can use unsafe-totalstd/core/unsafe/unsafe-total: forall<a,e> (action : () -> e a) -> a to dismiss built-in effects without handlers which include:

Do not dismiss io since it has the exn effect that should be handled (and an evidence vector should be passed in).

Try to avoid using unsafe-totalstd/core/unsafe/unsafe-total: forall<a,e> (action : () -> e a) -> a to initialize global values that have a side-effect, but use delay instead:

val myglobal = delay( fn() initialize() )
fun get-global() : e int
  myglobal.force
val myglobal = delay( fn() initialize() )
fun get-global() : e intstd/core/types/int: V
  myglobal.force
.

private import std/core/typesstd/core/types