Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
LambdaConf: Idris Workshop
Search
Brian McKenna
April 19, 2014
Programming
150
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
LambdaConf: Idris Workshop
Brian McKenna
April 19, 2014
Transcript
39 slides
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
More Decks by Brian McKenna
See All by Brian McKenna
Production PureScript
puffnfresh
0
140
PureScript
puffnfresh
2
600
Boulder Startup Week: What is functional programming?
puffnfresh
0
76
Other Decks in Programming
See All in Programming
[DroidKnights 2026] Workflow AX 적용기 — 자동 정책 정리부터 E2E까지
dayeon
0
120
Kotlin Fest 2026: Kotlin コンパイラに Contribute してみよう! - Kotlin/Wasm で深い再帰を書けるようにした話
ternbusty
1
420
AWS CDKを理解するために公式の定義を深掘って解説してみる / Understanding AWS CDK by Digging into Its Official Definition
akihisaikeda
3
340
DroidKnights 2026 Android A2UI Jetpack Compose 기반의 안전한 AI UI 렌더링 - 박제창
itsmedreamwalker
1
260
Ruby から Emacs を操作したい
phigasui
0
390
Distance field of Julia set
kinakomoti321
0
330
How SRE Grew Out of Server-Side Work and Became the Team's Own / サーバサイドから始まったSREを チームに渡すまで
maaaato
0
210
React Native経験者が Flutterを30⽇間触って驚いたこと
3saito
0
210
TS 7.0 で baseUrl が使えなくなった今、パスエイリアスをどうするか
bicstone
2
810
RaspberryPi 5で軽くはじめるk3sとtailscaleを用いたホームサーバー構築 (1)
nasum
0
440
protojson における文字化けの扱い
kazuki1023
0
460
AppFunctionsの内部実装を紐解く
hiroaki404
0
120
Featured
See All Featured
Accessibility Awareness
sabderemane
1
310
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
850
Unsuck your backbone
ammeep
672
58k
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
480
We Have a Design System, Now What?
morganepeng
55
8.4k
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.6k
The SEO identity crisis: Don't let AI make you average
varn
0
630
The Art of Programming - Codeland 2020
erikaheidi
57
15k
Reality Check: Gamification 10 Years Later
codingconduct
0
2.4k
Bootstrapping a Software Product
garrettdimon
PRO
306
120k
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.4k