【发布时间】:2018-01-08 16:17:56
【问题描述】:
我写下这个:
data IsTag : String -> Type where
NumIsTag : IsTag "num"
StrIsTag : IsTag "str"
arr1 : List (tag : String ** (IsTag tag, (case tag of "num" => Int; "str" => String)))
arr1 = [("num" ** (NumIsTag, 1)), ("str" ** (StrIsTag, "hello"))]
并得到以下使用错误消息:
When checking right hand side of arr1 with expected type
List (tag : String **
(IsTag tag, case tag of "num" => Int "str" => String))
When checking argument b to constructor Builtins.MkPair:
case "num" of
"num" => Int
"str" => String is not a numeric type
但我不明白,为什么case "num" of "num" => Int; "str" => String 不是数字类型?不是等于Int吗?
【问题讨论】:
标签: idris dependent-type