idris

    1熱度

    1回答

    我很困惑。 module Experiment import Data.Vect p1: Elem 5 [3,4,5,6] p1 = There (There Here) v : Vect 4 Int v = 3 :: 4 :: 5 :: 6 :: Nil p2: Elem 5 v p2 = There (There Here) 的p2的定義不進行類型檢查,而p1的定義一

    0熱度

    1回答

    在伊德里斯,你能建立一個Fin n和(x ** So (x < n))之間的同構嗎? (我實際上並不知道伊德里斯,所以這些類型可能不是有效的。總體思路是我們有一個數據類型,通過構建保證小於n,另一個通過測試保證小於n )

    2熱度

    1回答

    在下面的代碼中,爲什麼@{myOrd}放置在他的參數之前而不是之後? [myOrd] Ord Nat where compare Z (s n) = GT compare (S n) Z = LT compare (z z = EQ compare (S x) (S y) = compare @{myOrd} x y 有什麼優點和缺點?

    0熱度

    2回答

    我有一個模塊,其名稱以Data.List結尾。 在裏面我想從基礎庫導入模塊Data.List。 module Foo.Data.List import Data.List 如果我調用從文件夾Foo伊德里斯那麼編譯器抱怨: [Foo]$ idris --check Data/List.idr Cycle detected in imports: Data/List.idr -> Data/L

    1熱度

    1回答

    試圖解決有關矩陣乘法的練習Type driven development with Idris已經導致我成爲一個煩人的問題。 到目前爲止,我已經結束了定義這樣一組輔助功能: morexs : (n : Nat) -> Vect m a -> Vect n (Vect m a) morexs n xs = replicate n xs mult_cols : Num a => Vect m (

    3熱度

    1回答

    我一直無法說服我的功能是完整的伊德里斯總體檢查。以下是我遇到的問題的簡單示例版本。假設我們有以下形式的一個非常簡單的表達式類型: data SimpleType = Prop | Fn SimpleType SimpleType data Expr : SimpleType -> Type where Var : String -> Expr type Lam : Stri

    1熱度

    1回答

    在Haskell中,有mod和rem函數。 Idris中是否有類似的功能,特別是Nat?

    5熱度

    2回答

    在伊德里斯,我可以通過添加相同大小的兩個向量: *MatrixMath> :l MatrixMath.idr Type checking ./MatrixMath.idr 我可以: module MatrixMath import Data.Vect addHelper : (Num n) => Vect k n -> Vect k n -> Vect k n addHelper

    5熱度

    1回答

    除了具有隱含參數之外,Agda還允許您省略顯式參數的值並將其替換爲由_字符表示的元變量,其值將通過與隱式解析相同的過程來確定。 Idris是否有類似的功能,或者是隱式參數是將元變量引入程序的唯一方式?

    3熱度

    1回答

    下面是本教程中,稍加修改簡單的例子: data Vect : Nat -> (b:Type) -> Type where Nil : Vect Z a (::) : a -> Vect k a -> Vect (S k) a data Elem : a -> Vect n a -> Type where Here : {x:a} -> {xs:Vect n a}