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
6
votes
2 answers

idris cabal install fails. "The following packages are likely to be broken by the reinstalls"

I first do the cabal update/upgrade process so I have cabal-install-1.20.0.3. Then I do: cabal install idris I get: ... idris-0.9.14.1 (new version) The following packages are likely to be broken by the…
clay
  • 18,138
  • 28
  • 107
  • 192
6
votes
3 answers

Idris function to construct empty `List a` where `a` is bound to an instance of `Ord`?

I've only read the standard tutorial and fumbled around a bit, so I may be missing something simple. If this isn't possible in Idris, please explain why. Furthermore, if can be done in another language please provide a code sample and explain what's…
Sage Mitchell
  • 1,563
  • 8
  • 31
6
votes
2 answers

How can I get the source code of Idris standard library?

I'm intrested because I would like to inspect the definitions of built-in functions in Prelude. I searched for it, but only found the precompiled files in ~/.cabal/share/idris...
Boldizsár Németh
  • 1,847
  • 13
  • 20
6
votes
2 answers

Cabal fails to install Idris language on OSX Lion

I'm trying to install the Idris language in an OSX Lion using the installation guide provided on the official tutorial. I have alraedy installed GMP. This is the error I get: $ cabal install idris Resolving dependencies... Configuring…
MaiaVictor
  • 51,090
  • 44
  • 144
  • 286
5
votes
1 answer

What %inline really do on Idris? and when to use it?

Reading Idris2 code I've seen several cases of functions "decorated" with %inline and also %tcinline I've been searching for a clear explanation about it but haven't found anything except that it "can" be used for giving some "hints" to help on…
allor99
  • 111
  • 3
5
votes
2 answers

How can I call an individual Idris function from JavaScript?

Suppose I have a function in Idris that does some computation. For simplicity, let it be stringly typed for now. f: String -> String How can I compile this function to JavaScript so that it can then be called from any ordinary JavaScript code? If…
Ignat Insarov
  • 4,660
  • 18
  • 37
5
votes
0 answers

Idris: Prove complex numbers multiplication is associative

I'd like to verify the Ring instance for Data.Complex.Complex t assuming of course t is also Ring. It was easy until Abelian Group, but with the Ring instance something weird is going on: VerifiedRing t => VerifiedRing (Complex t) where …
Sventimir
  • 1,996
  • 3
  • 14
  • 25
5
votes
1 answer

Lifting existentials to type level

tl;dr: I'm trying to rewrite some dependently-typed code that has a list of sigma-types in Haskell, and I can't seem to generate singletons for an existential, in other words this code fails: data Foo :: Type where Foo :: forall foo. Sing foo ->…
0xd34df00d
  • 1,496
  • 1
  • 8
  • 17
5
votes
1 answer

Type functions at run-time in Idris

I've going over Type-driven development, and there is a section on a well-typed printf, where the type is calculated from the first argument which is a format string: printf : (fmt : String) -> PrintfType (toFormat (unpack fmt)) toFormat creates a…
corazza
  • 31,222
  • 37
  • 115
  • 186
5
votes
2 answers

Total definition of Gcd in Idris

I am working in a small project with a goal to give a definition of Gcd which gives the gcd of two numbers along with the proof that the result is correct. But I am unable to give a total definition of Gcd. The definition of Gcd in Idris 1.3.0 is…
Arka
  • 249
  • 1
  • 8
5
votes
2 answers

Theorem Proving in Idris

I was reading Idris tutorial. And I can't understand the following code. disjoint : (n : Nat) -> Z = S n -> Void disjoint n p = replace {P = disjointTy} p () where disjointTy : Nat -> Type disjointTy Z = () disjointTy (S k) = Void So…
Johnny Liao
  • 579
  • 4
  • 13
5
votes
1 answer

Is it possible to abstract over kinds in Idris?

I'm going through Type Driven Development with Idris, learning about how to define functions with variable numbers of arguments. I got a little ambitious and wanted to write a mapN function that would map a function of (n : Nat) arguments onto n…
James MacAulay
  • 317
  • 2
  • 6
5
votes
2 answers

Idris - Eq for enumerated type

Suppose I have an enumerated type like data MyType = One | Two | Three ... | Ten and I would like to implement the Eq interface for it. I could do it as follows Eq MyType where One == One = True Two == Two = True …
marcosh
  • 8,780
  • 5
  • 44
  • 74
5
votes
2 answers

Idris - proving equality of two numbers

I would like to write a function that takes two natural arguments and returns a maybe of a proof of their equality. I'm trying with equal : (a: Nat) -> (b: Nat) -> Maybe ((a == b) = True) equal a b = case (a == b) of True => Just Refl False…
marcosh
  • 8,780
  • 5
  • 44
  • 74
5
votes
1 answer

Idris - Define a primes type

I am learning Idris and as a personal exercise, I would like to implement a Primes type, consisting of all the prime numbers. Is there a way in idris to define a new type starting from a type and a property, which will select all the elements of the…
marcosh
  • 8,780
  • 5
  • 44
  • 74