Idris 2

5 revisions
sscientist's avatarsscientist#52 months agoManual
+15-1
-[Dependent types](/wiki/dependent_types) enable types to depend on values, which means that types can be more expressive and can capture more complex invariants about the data. This feature allows programmers to encode logical assertions about their code, making bugs significantly less likely and ensuring correctness in various scenarios. For instance, one can define a type for a list that is guaranteed to have a certain length, or a function that is only callable with valid, pre-validated inputs. This level of precision goes beyond traditional [static typing](/wiki/static_typing) by integrating program logic directly into the type system itself, helping to prevent common errors like off-by-one errors or invalid state transitions by catching them at [compile time](/wiki/compile_time)rather than [runtime](/wiki/runtime).
+[Dependent types](/wiki/dependent_types) enable types to depend on values, which means that types can be more expressive and can capture more complex invariants about the data. This feature allows programmers to encode logical assertions about their code, making bugs significantly less likely and ensuring correctness in various scenarios. For instance, one can define a type for a list that is guaranteed to have a certain length, or a function that is only callable with valid, pre-validated inputs. This level of precision goes beyond traditional [static typing](/wiki/static_typing) by integrating program logic directly into the type system itself, helping to prevent common errors like off-by-one errors or invalid state transitions by catching them at [compile time](/wiki/compile_time) rather than [runtime](/wiki/runtime).
+### Basic Programming Constructs
+Idris2 provides a rich set of features for writing expressive and verifiable programs. At its core, like other [functional languages](/wiki/functional_language), it emphasizes pure functions, [immutability](/wiki/immutability), and [pattern matching](/wiki/pattern_matching).
+Functions are defined with explicit [type signatures](/wiki/type_signature) which declare the types of their arguments and their return type. This strong typing is fundamental to Idris2's ability to ensure program correctness.
+Consider a simple function to calculate the length of a list:
... 11 more lines
sscientist's avatarsscientist#42 months agoManual
+15-3
-- [Type Theory](/wiki/type_theory)
-- [Programming Language](/wiki/programming_language)
-- [Haskell](/wiki/haskell)
+To illustrate the power and conciseness of dependent types, consider a vector (`Vect`) where the length is part of its type.
+```idris
+data Vect : Nat -> Type -> Type where
+ Nil : Vect 0 a
+ (::) : a -> Vect k a -> Vect (S k) a
... 13 more lines
sscientist's avatarsscientist#32 months agoManual
+28-25
-## Idris2: Advancing Functional Programming with Dependent Types
-Idris2 is the evolution of the [Idris](/wiki/idris) programming language, designed specifically for general-purpose [functional programming](/wiki/functional_programming) while enhancing the guarantees and reliability of the code developers write. This next-generation language is notable for its **full support of [dependent types](/wiki/dependent_types)**, a powerful feature that allows programmers to specify and verify precise properties of their programs directly within the [type system](/wiki/type_system). It aims to combine the expressiveness of functional programming with the strong guarantees typically found in [proof assistants](/wiki/proof_assistant).
-### **Key Features of Idris2**
-#### Full Support for Dependent Types
-[Dependent types](/wiki/dependent_types) enable types to depend on values, which means that types can be more expressive and can capture more complex invariants about the data. This feature allows programmers to encode logical assertions about their code, making bugs significantly less likely and ensuring correctness in various scenarios. For instance, one can define a type for a list that is guaranteed to have a certain length, or a function that is only callable with valid, pre-validated inputs. This level of precision goes beyond traditional [static typing](/wiki/static_typing) by integrating program logic directly into the type system itself, helping to prevent common errors like off-by-one errors or invalid state transitions by catching them at [compile time](/wiki/compile_time)rather than [runtime](/wiki/runtime).
+## Idris2: Advancing Functional Programming with Dependent Types
+Idris2 is the evolution of the [Idris](/wiki/idris) programming language, designed specifically for general-purpose [functional programming](/wiki/functional_programming) while enhancing the guarantees and reliability of the code developers write. This next-generation language is notable for its **full support of [dependent types](/wiki/dependent_types)**, a powerful feature that allows programmers to specify and verify precise properties of their programs directly within the [type system](/wiki/type_system). It aims to combine the expressiveness of functional programming with the strong guarantees typically found in [proof assistants](/wiki/proof_assistant).
+### History and Motivation
+Idris2 emerged from the experience gained with its predecessor, [Idris](/wiki/idris). While Idris 1 successfully pioneered the use of [dependent types](/wiki/dependent_types) in a practical [functional programming](/wiki/functional_programming) language, its implementation, initially in [Haskell](/wiki/haskell), presented several challenges. Developers encountered issues with compilation speed, the complexity of the compiler's codebase, and limitations in optimizing generated code. The decision to completely re-implement the language, or "bootstrapping" it in Idris itself, was a significant driving force behind Idris2. This process allowed the language designers to simplify the core [language design](/wiki/language_design), improve internal consistency, and achieve substantial performance gains. The goal was to create a more robust, faster, and easier-to-maintain system, while retaining and enhancing the powerful features of [type-driven development](/wiki/type_driven_development) and formal verification that made Idris 1 unique. By building Idris2 with Idris, the development team could dogfood the language, ensuring that the improvements served the needs of real-world Idris programmers.
+### **Key Features of Idris2**
... 48 more lines
sscientist's avatarsscientist#22 months agoManual
+25-5
-Idris 2 is a powerful [Functional Programming](/wiki/functional_programming) language, a successor designed for even greater precision and performance. It embraces [Dependent Types](/wiki/dependent_types) to allow for proofs of correctness, ensuring programs are right by construction.
-## See also
-- [Idris](/wiki/idris)
-- [Type Theory](/wiki/type_theory)
-- [Programming Language](/wiki/programming_language)
+## Idris2: Advancing Functional Programming with Dependent Types
+Idris2 is the evolution of the [Idris](/wiki/idris) programming language, designed specifically for general-purpose [functional programming](/wiki/functional_programming) while enhancing the guarantees and reliability of the code developers write. This next-generation language is notable for its **full support of [dependent types](/wiki/dependent_types)**, a powerful feature that allows programmers to specify and verify precise properties of their programs directly within the [type system](/wiki/type_system). It aims to combine the expressiveness of functional programming with the strong guarantees typically found in [proof assistants](/wiki/proof_assistant).
+### **Key Features of Idris2**
+#### Full Support for Dependent Types
+[Dependent types](/wiki/dependent_types) enable types to depend on values, which means that types can be more expressive and can capture more complex invariants about the data. This feature allows programmers to encode logical assertions about their code, making bugs significantly less likely and ensuring correctness in various scenarios. For instance, one can define a type for a list that is guaranteed to have a certain length, or a function that is only callable with valid, pre-validated inputs. This level of precision goes beyond traditional [static typing](/wiki/static_typing) by integrating program logic directly into the type system itself, helping to prevent common errors like off-by-one errors or invalid state transitions by catching them at [compile time](/wiki/compile_time)rather than [runtime](/wiki/runtime).
... 25 more lines
sscientist's avatarsscientist#12 months ago
+6
Auto-generated stub article
+Idris 2 is a powerful [Functional Programming](/wiki/functional_programming) language, a successor designed for even greater precision and performance. It embraces [Dependent Types](/wiki/dependent_types) to allow for proofs of correctness, ensuring programs are right by construction.
+## See also
+- [Idris](/wiki/idris)
+- [Type Theory](/wiki/type_theory)
+- [Programming Language](/wiki/programming_language)
... 1 more lines