Questions tagged [idris]

Idris is a general purpose pure functional programming language with dependent types.

Idris is a general-purpose purely functional programming language with dependent types, strict or optional lazy evaluation and features such as a totality checker.


Useful links:

785 questions
1
vote
1 answer

Strange error message in Idris

I'm implementing in Idris the algorithm and proofs of first-order unification by structural recursion (current status of the development available here). Idris in giving me the following error message `-- UnifyProofs.idr line 130 col 60: When…
Rodrigo Ribeiro
  • 3,198
  • 1
  • 18
  • 26
1
vote
1 answer

Cabal building failling when installing idris

When I run the command sudo cabal install idris I run into this error: Build log ( /home/kyle/.cabal/logs/xss-sanitize-0.3.5.6.log ): cabal: /home/kyle/.cabal/logs/xss-sanitize-0.3.5.6.log: does not exist What can I do to fix this? this is the…
Kyle McKean
  • 445
  • 2
  • 11
1
vote
2 answers

Propositions vs. boolean values for input validation

I have the following code: doSomething : (s : String) -> (not (s == "") = True) -> String doSomething s = ?doSomething validate : String -> String validate s = case (not (s == "")) of False => s True =>…
Blezz
  • 313
  • 1
  • 10
1
vote
1 answer

How to fully evaluate case block in type

In Idris you can have complex computations in the types themselves, like a case block in this function: fun_1 : (n : Nat) -> case n of { Z => Bool; _ => Nat} fun_1 Z = True fun_1 (S n) = S n But how would you be able to fully evaluate such a…
gonzaw
  • 771
  • 4
  • 17
1
vote
1 answer

Idris rewrite tactic doesn't work as expected

I have this example o : Type Hom : o -> o -> Type Id : (a : o) -> Hom a a Comp : Hom a b -> Hom b c -> Hom a c IdRight : (f : Hom a b) -> Comp f (Id b) = f IdLeft : (f : Hom a b) -> Comp (Id a) f = f Assoc : (f : Hom a b) -> …
1
vote
1 answer

Confused about an intermediate type in Idris

I'm trying to implement a toy regular type system that ensures a few well formediness side constraints and allows for unfolding mu bindings in it. The data type representing these types contains constructors for fixed point (Mu), replacement by the…
1
vote
1 answer

How can I arrange to pattern match on a dependent view?

I've written some simple types for viewing Vect values: data SnocVect : Vect n a -> Type where SnocNil : SnocVect [] Snoc : (xs : Vect n a) -> (x : a) -> SnocVect (xs ++ [x]) data Split : (m : Nat) -> Vect n a -> Type where MkSplit : (xs :…
dfeuer
  • 48,079
  • 5
  • 63
  • 167
1
vote
1 answer

What's the best way to use a number at compile time and run time?

I am just starting to learn Idris, and I figured a nice little project to start off would be to implement finite sequences as 2-3 finger trees. Each internal node in a tree needs to be annotated at run time with the total number of elements stored…
dfeuer
  • 48,079
  • 5
  • 63
  • 167
1
vote
1 answer

Unsolved metavariable for function that has no inhabited arguments

I am getting an unsolved metavariable for foo in the code below: namespace Funs data Funs : Type -> Type where Nil : Funs a (::) : {b : Type} -> (a -> List b) -> Funs (List a) -> Funs (List a) data FunPtr : Funs a -> Type -> Type where …
Cactus
  • 27,075
  • 9
  • 69
  • 149
1
vote
1 answer

Null pointer in Idris FFI

How do I call a function with a NULL parameter of type FPtr with the Idris FFI? I've looked through the library, and it looks like there's neither a null pointer nor a way to cast integers to pointers.
jch
  • 5,382
  • 22
  • 41
1
vote
1 answer

Syntax error when using views

I've the following code (mostly auto-generated by playing with idris-mode in emacs): module Main data Parity : Nat -> Type where even : (n : Nat) -> Parity (n + n) odd : (n : Nat) -> Parity (S (n + n)) parity : (n : Nat) -> Parity n parity Z =…
Ramon Snir
  • 7,520
  • 3
  • 43
  • 61
1
vote
1 answer

Cong, subst and equality type in dependently typed programming languages

In dependently typed type theory there's a equality type. Usually when this type is defined, a number of utilities, namely cong and subst are introduced. How expressive they are? Is it possible to express everything we can with eliminator for…
Konstantin Solomatov
  • 10,252
  • 8
  • 58
  • 88
0
votes
0 answers

Updating a dependently typed field without updating what it depends on

I'd like to use record update syntax to update a dependently-typed field without also changing the field it depends on. So I'd like to have Idris 2 evaluate the other field, and realize everything is kosher. Is this doable? Here's a concrete minimal…
Cactus
  • 27,075
  • 9
  • 69
  • 149
0
votes
1 answer

How to use the result of a depedent pair?

I am learning dependent pairs in idris and couldn't understand how one can use it. For example, if I filter a Data.List, I get back a Data.List, which you I do sum or other computations on. sum $ filter (< 3) [1,2,3,4] 3 But if I filter a…
thor
  • 21,418
  • 31
  • 87
  • 173
0
votes
0 answers

How to fix an inaccessible variable in idris2?

I am having trouble to make a short idris2 code from the summer school course SPLV20 work. The error is at the last line: module Text.Token %default total ||| For a type `kind`, specify a way of converting the recognised ||| string into a value.…
thor
  • 21,418
  • 31
  • 87
  • 173