3 ms·
Types usually describe values. Compilers use types to prove various things about possible values, like their size, alignment, valid bit patterns, etc. Effects
by newpavlov 2y ago
Types usually describe values. Compilers use types to prove various things about possible values, like their size, alignment, valid bit patterns, etc.
Effects describe code. For example, a "panic" effect states that function may trigger panic/exception during its execution. In other words, existence or absence of an effect is a function property. You can view effects as special types which are used only for functions (to be slightly more precise, signature + effects form function type), but you would need to use a slightly more advanced notion of type system which includes subtyping, e.g. function "panic fn(u32) -> u64" can be used in place of "panic io fn(u32) -> u64".