类型在 运行 时间之前被擦除

Types are erased before run time

我确信在 Haskell 中类型总是在 运行 之前被删除。在 Agda 的情况下会发生什么?

依赖类型信息是否传递到运行-时间?

什么运行时?至少有四个后端:针对 GHC(称为 MAlonzo)、UHC、Epic 和 JavaScript 的后端。可以在 the Agda wiki: you can read how the Epic backend erases types there or in this paper (the "3.3 Erasure" chapter). In short, the Epic and the UHC backends erase all types that a fully applied function receives, but doesn't perform full erasure as it can change the semantics of a program (quoted from a paper 中找到有关 UHC 后端的一些初始详细信息):

Type translation

The remaining terms Π, Set and Level are significant for type checking only. In Agda, a value of type Set or Level cannot be inspected or pattern matched. As Agda enforces that it is impossible to observe any value of these types, they cannot affect the runtime semantics. For executing a program, it is thus safe to replace all occurrences of such values by the unit value .

One could also be tempted to completely remove any values of these kind. This could potentially alter the semantics of the translated program. Agda does not evaluate expressions under lambdas; dropping lambda abstractions taking type expressions could remove evaluation-blocking lambdas. A partial erasure of types is possible in a sound way. Saturated function applications for example can always be optimized in this way. A more detailed description of when such types may be soundly erased can be found in previous work by Letouzey.