Idris 中类型的模式匹配

Pattern matching on Type in Idris

可能是基本的,但我不明白为什么以下函数对 fnc Natfnc Integer 的回答是 1,这甚至不包括在模式中。

fnc : Type -> Integer
fnc Bool = 1
fnc Nat = 2

您不能对类型进行模式匹配,也不应该。当我编译你的代码时,我收到下一个错误:

warning - Unreachable case: fnc Nat

前面已经讨论过了:

  1. Old discussion.
  2. Some similar issue on GitHub.

更新:

终于找到了更相关的问题和答案:

Why is typecase a bad thing?