Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
LambdaConf: Idris Workshop
Search
Brian McKenna
April 19, 2014
Programming
2
130
LambdaConf: Idris Workshop
Brian McKenna
April 19, 2014
Tweet
Share
More Decks by Brian McKenna
See All by Brian McKenna
Production PureScript
puffnfresh
0
120
PureScript
puffnfresh
2
590
Boulder Startup Week: What is functional programming?
puffnfresh
0
68
Other Decks in Programming
See All in Programming
Strategy for Finding a Problem for OSS: With Real Examples
kibitan
0
110
AIコードレビューの導入・運用と AI駆動開発における「AI4QA」の取り組みについて
hagevvashi
0
560
How to stabilize UI tests using XCTest
akkeylab
0
140
モックわからないマン卒業記 ~振る舞いを起点に見直した、フロントエンドテストにおけるモックの使いどころ~
tasukuwatanabe
3
420
Nuxt Server Components
wattanx
0
130
エンジニアの「手元の自動化」を加速するn8n 2026.02.27
symy2co
0
180
テレメトリーシグナルが導くパフォーマンス最適化 / Performance Optimization Driven by Telemetry Signals
seike460
PRO
2
170
メッセージングを利用して時間的結合を分離しよう #phperkaigi
kajitack
3
330
CSC307 Lecture 15
javiergs
PRO
0
270
今年もTECHSCOREブログを書き続けます!
hiraoku101
0
120
見せてもらおうか、 OpenSearchの性能とやらを!
shunta27
1
140
2026-03-27 #terminalnight 変数展開とコマンド展開でターミナル作業をスマートにする方法
masasuzu
0
160
Featured
See All Featured
Optimizing for Happiness
mojombo
378
71k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
1
490
Crafting Experiences
bethany
1
94
Paper Plane (Part 1)
katiecoart
PRO
0
5.9k
Git: the NoSQL Database
bkeepers
PRO
432
67k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
150
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
2.5k
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.2k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
2
1k
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.1k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
130
Information Architects: The Missing Link in Design Systems
soysaucechin
0
840
Transcript
LEARN DEPENDENTLY- TYPED PROGRAMMING WITH IDRIS
WHO I AM
▸ @puffnfresh ▸ Tiny contributor to Idris (18 commits) ▸
Played with dependent types for 2 years ▸ Been doing Idris for 6 months
ASSUMPTIONS
▸ Small experience with Haskell ▸ Have an install of
Idris (can be tricky)
$ brew install ghc cabal-install $ cabal update $ cabal
install alex $ cabal install idris
None
OUTLINE
1. Overview of dependent types and Idris 2. Work through
exercises, I lead 3. Work through exercises, I help
MOTIVATION
Bad news: most software cannot be reasoned about — Paul
Phillips
▸ Curry-Howard; programs are proofs ▸ Let's make our proofs
interesting ▸ Therefore let's use a powerful type system
MISCONCEPTIONS
▸ Idris is harder than Haskell ▸ Dependent types are
hard
DEPENDENT TYPES EVERYTHING IS A TERM
isIdris : Bool isIdris = True one : Nat one
= if isIdris then S Z else Z StringList : Type StringList = if isIdris then List Char else Int
▸ Types and kinds are values in universes ▸ Types
can depend on values ▸ Free polymorphism, type constructors
the : (t : Type) -> (x : t) ->
t the _ a = a one : Nat one = the Nat Z
id1 : {t : Type} -> (x : t) ->
t id1 {t} a = a id2 : (x : t) -> t id2 a = a id3 : t -> t id3 a = a
Option : Type -> Type Option = Maybe
TOTALITY
$ idris --total $ idris --warnpartial %default total total plusOne
: Nat -> Nat plusOne Z = S Z plusOne (S n) = S (S n)
I am often asked ‘how do I implement a server
as a program in your terminating language?’ — Conor McBride
I reply that I do not: a server is a
coprogram in a language guaranteeing liveness — Conor McBride
▸ We always make progress ▸ Watch out for the
totality checker! ▸ Church-Rosser theorem ▸ Evaluation is really normalisation! ▸ Can still do it all!
EQUALITY
data (=) : a -> b -> Type where refl
: x = x x : 1 = 1 x = refl y : 1 + 1 = 2 y = refl
x : {a : Nat} -> a - a =
Z x {a=Z} = refl x {a=S k} = x {a=k} y : {a : Nat} -> a - a = Z y {a} = replace {P = \x => (a - x = Z)} (plusZeroRightNeutral a) (minusPlusZero a Z)
x : {a : Nat} -> a - a =
Z x = ?xproof xproof = proof intros rewrite (minusPlusZero a Z) rewrite (plusZeroRightNeutral a) trivial
▸ The problem of dependent types ▸ Values are unified
▸ Checked for syntactic/term equality
WHY IDRIS?
▸ LLVM, C, Java, JS backends ▸ FFI ▸ Lots
of syntactic sugar ▸ Tactic rewriting ▸ Allows more lying/cheating ▸ REPL, editor modes, doc tools
None
None
HOW TO IDRIS
▸ Idris Tutorial ▸ Idris library docs ▸ Idris library
source ▸ Beginning Haskell: a Project Based Approach
LET'S GO
▸ printf ▸ Equality proofs ▸ Verified algebra ▸ Vector
filtering
http://goo.gl/gfCJne