idris

    1熱度

    1回答

    我想實現像在伊德里斯功能隊列,但它攜帶在類型元素的數目 - 如Queue ty n m (n+m)其中n是一個Vect n ty元素的數量,m是第二個元素Vect m ty,而(n+m)是總元素。 的問題是,我遇到了問題與操縱這些尺寸爲隱式參數時應用重寫規則: module Queue import Data.Vect as V data Queue : Type -> Nat -> Na

    3熱度

    1回答

    我試圖實現Semigroup接口,用於伊德里斯簡單依賴對,取決於對但這並不編譯: Semigroup (n ** Vect n f) where (<+>) (_ ** xs) (_ ** ys) = (_ ** xs ++ ys) 與錯誤 Type mismatch between ty and Nat 但是這樣編譯: myPair:Type -> Typ

    1熱度

    2回答

    我可以在Windows中將我的初始化腳本放在idris REPL的位置? 如果我把命令 C:\Users\frankr85\Application Data\idris\repl\init 沒有加載內容。 任何想法?

    0熱度

    1回答

    我想編譯Idris中的interface的簡單示例。 interface Foo a where foo : a -> String 但我不斷收到這種類型檢查錯誤: error: expected: "with", argument expression, function right hand side, implicit function argument, with p

    1熱度

    2回答

    鑑於從Type-Driven Development with Idris如下: import Data.Vect data EqNat : (num1 : Nat) -> (num2 : Nat) -> Type where Same : (num : Nat) -> EqNat num num sameS : (eq : EqNat k j) -> EqNat

    2熱度

    1回答

    鑑於下面的部分功能(沒有輸出用於Nothing輸入)的理解輸出: f : Maybe Int -> Maybe Int f (Just 42) = Just 42 的REPL顯示以下內容: *Lecture> f $ Just 42 Just 42 : Maybe Int *Lecture> f Nothing f Nothing : Maybe Int 什麼是f Nothing

    0熱度

    1回答

    有哪些內容(a, b, c: Nat)參數的含義是: g : (a, b, c: Nat) -> Int g (a,b,c) = 42 ?顯然,第一個參數是三元組,即3元組。

    2熱度

    2回答

    我想創建一個數據類型交替構造Foo和Bar。有效成員,例如,將是: Foo (Bar (Foo (Bar End))) 但不是: Foo (Foo (Bar End)) 因爲後者已經連續Foo的。在單一數據聲明中表達這一點的正確方法是什麼?

    3熱度

    1回答

    我玩弄伊德里斯和我碰到一些東西,混淆了我一點點走過來: 以下類型檢查: conc : Vect n a -> Vect m a -> Vect (n+m) a conc [] ys = ys conc (x :: xs) ys = x :: (conc xs ys) 但這並不: conc : Vect n a -> Vect m a -> Vect (m+n) a conc [] ys

    3熱度

    2回答

    我是Idris的新手,我試圖去捕捉基本概念和語法。 即使它聽起來毫無意義,我試圖定義一個將自然減半的half函數。 我想拿出類似: half : (n : Nat) -> (k : Nat) -> (n = k + k) -> (k : Nat) 但當然不工作。具體來說,我得到: error: expected: dependent type signature half : (n : Nat