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
26
votes
1 answer

indexed by a type vs containing a type in idris

I'm currently going through the Type-Driven Development with Idris book. I have two questions relating to the design of the example data store in Chapter 6. The data store is a command line application that allows the user to set what kind of data…
illabout
  • 3,517
  • 1
  • 18
  • 39
26
votes
1 answer

So: what's the point?

What is the intended purpose of the So type? Transliterating into Agda: data So : Bool → Set where oh : So true So lifts a Boolean proposition up to a logical one. Oury and Swierstra's introductory paper The Power of Pi gives an example of a…
Benjamin Hodgson
  • 42,952
  • 15
  • 108
  • 157
25
votes
3 answers

Why doesn't GHC Haskell support overloaded record parameter names?

What I am talking about is that it is not possible to define: data A = A {name :: String} data B = B {name :: String} I know that the GHC just desugars this to plain functions and the idiomatic way to solve this would be: data A = A {aName ::…
fho
  • 6,787
  • 26
  • 71
21
votes
2 answers

Idris vectors vs linked lists

Does Idris do any kind of optimization under the hood of vectors? Because from the looks of it, an Idris vector is just a linked list with known size (known at compile time). In fact, in general it seems like you could express the following…
limp_chimp
  • 13,475
  • 17
  • 66
  • 105
20
votes
1 answer

Generic programming via effects

In the Idris Effects library effects are represented as ||| This type is parameterised by: ||| + The return type of the computation. ||| + The input resource. ||| + The computation to run on the resource given the return value. Effect : Type Effect…
effectfully
  • 12,325
  • 2
  • 17
  • 40
19
votes
0 answers

Why not always use Inf instead of Lazy in Idris?

I find that Lazy and Inf is very close: Lazy and Inf are closely related (in fact, the underlying implementation uses the same type). The only difference in practice is in totality checking, where Lazy is erased (i.e. terms are checked for …
luochen1990
  • 3,689
  • 1
  • 22
  • 37
18
votes
1 answer

Generate library instead of executable in Idris?

Is there a way to generate a library instead of an executable using idris? If I try compiling without a main, I get an error like this: main:0:0:When elaborating an application of function run__IO: No such variable Main.main If I can generate a…
mushroom
  • 6,201
  • 5
  • 36
  • 63
18
votes
5 answers

Definition of a certified program

I see a couple of different research groups, and at least one book, that talk about using Coq for designing certified programs. Is there are consensus on what the definition of certified program is? From what I can tell, all it really means is…
wyer33
  • 6,060
  • 4
  • 23
  • 53
17
votes
0 answers

What is the Parigot Mendler encoding?

The following encoding of Nats is used in some Cedille sources: cNat : ★ cNat = ∀ X : ★ . X ➔ (∀ R : ★ . (R ➔ X) ➔ R ➔ X) ➔ X cZ : cNat cZ = Λ X . λ z . λ s . z cS : ∀ A : ★ . (A ➔ cNat) ➔ A ➔ cNat cS = Λ A . λ e . λ d . Λ X . λ z . λ s . s · A (λ…
MaiaVictor
  • 51,090
  • 44
  • 144
  • 286
16
votes
1 answer

Open Type Level Proofs in Haskell/Idris

In Idris/Haskell, one can prove properties of data by annotating the types and using GADT constructors, such as with Vect, however, this requires hardcoding the property into the type (e.g. a Vect has to be a separate type from a List). Is it…
David Harrison
  • 327
  • 2
  • 7
16
votes
2 answers

Can you create functions that return functions of a dependent arity in a dependently typed language?

From what I know about dependent types, I think that it should possible, but I've never seen an example of this before in a dependently typed language, so I'm not exactly sure where to start. What I want is a function of the form: f : [Int] -> (Int…
Nathan BeDell
  • 2,263
  • 1
  • 14
  • 25
16
votes
1 answer

Dependently typed printf in Idris

I am trying to translate to Idris an example from the Cayenne - a language with dependent types paper. Here is what I have so far: PrintfType : (List Char) -> Type PrintfType Nil = String PrintfType ('%' :: 'd' :: cs) = Int ->…
huynhjl
  • 41,520
  • 14
  • 105
  • 158
15
votes
3 answers

StringOrInt from Idris -> Scala?

Type Driven Development with Idris presents this program: StringOrInt : Bool -> Type StringOrInt x = case x of True => Int False => String How can such a method be written in Scala?
Kevin Meredith
  • 41,036
  • 63
  • 209
  • 384
15
votes
1 answer

How to specify a number range as a type in Idris?

I've been experimenting with Idris and it seems like it should be simple to specify some sort of type for representing all numbers between two different numbers, e.g. NumRange 5 10 is the type of all numbers between 5 and 10. I'd like to include…
Jack
  • 2,223
  • 13
  • 23
15
votes
1 answer

Why does Idris need mutual?

Why does Idris require that functions appear in the order of their definitions and mutual recursion declared with mutual? I would expect Idris to perform a first pass of dependency analysis between functions, and reorder them automatically. I have…
jch
  • 5,382
  • 22
  • 41
1
2
3
52 53