Language page — context, influences, and learning notes on the 100hellos site.
Source on GitHub (100hellos/idris2)
docker run --rm --platform="linux/amd64" 100hellos/idris2:latest
Read the repo README, or fork the project and customize it.
For an interactive shell:
docker run --rm --platform="linux/amd64" --entrypoint="" -it 100hellos/idris2:latest zsh
Idris2 is a purely functional programming language with dependent types, designed to be a practical programming language for type-driven development. It represents the evolution of the original Idris language with improved performance, better error messages, and enhanced tooling.
Dependent Types: Idris2's type system allows types to depend on values, enabling incredibly precise type specifications that can encode program invariants directly in the type system.
Type-Driven Development: The language encourages a development style where you start with types that express what your program should do, then implement the functions that satisfy those types.
Total Functions: Idris2 can verify that functions are total (always terminate and handle all possible inputs), providing strong guarantees about program behavior.
Linear Types: Idris2 includes support for linear types, which can express resource usage patterns and prevent common errors like use-after-free or double-free.
module Main
main : IO ()
main = putStrLn "Hello World!"
module Main declares this as the main modulemain : IO () specifies that main has type IO (), meaning it performs I/O actions and returns the unit typeputStrLn is the standard function for printing a line to stdoutIO type ensures that side effects are tracked in the type systemIn Idris2, you might define a vector type that encodes its length in the type:
data Vect : Nat -> Type -> Type where
Nil : Vect Z a
(::) : a -> Vect k a -> Vect (S k) a
This allows the type system to prevent index-out-of-bounds errors at compile time!
Idris2 represents the cutting edge of practical dependently-typed programming, making advanced type theory concepts accessible for everyday programming tasks.
Content type
Image
Digest
sha256:e6f8e2b49…
Size
53.2 MB
Last updated
4 months ago
docker pull 100hellos/idris2