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
Haskell - A brief introduction
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
MetaBroadcast
June 13, 2012
Programming
100
0
Share
Haskell - A brief introduction
Talk given by Fred van den Driessche on 13-06-2012 at MetaBroadcast.
MetaBroadcast
June 13, 2012
More Decks by MetaBroadcast
See All by MetaBroadcast
PhotoGlut
metabroadcast
2
380
Machine learning: boldly going where Twitter's APIs don't
metabroadcast
0
140
monitoring: it gets better
metabroadcast
1
590
The ABCs of MetaBroadcast APIs
metabroadcast
0
230
APIs for app developers
metabroadcast
1
160
Polishing Varnish
metabroadcast
0
830
Atlas - 3.0 to 4.0
metabroadcast
0
250
Atlas - owl vs deer
metabroadcast
0
250
Storm - an overview
metabroadcast
0
130
Other Decks in Programming
See All in Programming
From Formal Specification to Property Based Test
ohbarye
0
360
セグメントとターゲットを意識するプロポーザルの書き方 〜採択の鍵は、誰に刺すかを見極めるマーケティング戦略にある〜
m3m0r7
PRO
0
590
HTML-Aware ERB: The Path to Reactive Rendering @ RubyKaigi 2026, Hakodate, Japan
marcoroth
0
290
Spec-driven Development: How AI Changes Everything (And Nothing)
simas
PRO
0
270
Angular Signal Forms
debug_mode
0
120
tRPCの概要と少しだけパフォーマンス
misoton665
2
240
アーキテクチャモダナイゼーションとは何か
nwiizo
19
5.5k
AI時代のエンジニアリングの原則 / Engineering Principles in the AI Era
haru860
0
620
Running Swift without an OS
kishikawakatsumi
0
850
Claude CodeでETLジョブ実行テストを自動化してみた
yoshikikasama
0
840
実践CRDT
tamadeveloper
0
590
ドメインイベントでビジネスロジックを解きほぐす #phpcon_odawara
kajitack
3
800
Featured
See All Featured
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.6k
Done Done
chrislema
186
16k
Between Models and Reality
mayunak
3
270
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.7k
The Pragmatic Product Professional
lauravandoore
37
7.2k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
120
[SF Ruby Conf 2025] Rails X
palkan
2
980
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
310
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
Everyday Curiosity
cassininazir
0
200
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
54k
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.2k
Transcript
Haskell A Brief Introduction
Pure Functional Lists Lazy • • •
Built-in Types Numbers: 1, 1.234 Booleans: True, False Characters/Strings: 'a',
"asdf" Lists: [1,2,3] Tuples:("jim", 25) • • • • •
Functions double x = 2 * x > double 5
10
Control max x y = if x > y then
x else y max x y | x > y = x | otherwise y
Lists [] 1 : [2, 3] = [1, 2, 3]
[1, 2] ++ [3, 4] = [1, 2, 3, 4] head [1, 2, 3] = 1 tail [1, 2, 3] = [2, 3]g • • • • •
Pattern Matching dblAll [] = [] dblAll (x:xs)= double x
: dblAll xs
Higher-order functions > map double [1, 2, 3] [2, 4,
6] map f [] = [] map f (x:xs) = f x : map f xs
Function Types > :t double double :: Num a =>
a -> a > :t (*) (*) :: Num a => a -> a -> a > :t map map :: (a -> b) -> [a] -> [b]
Currying > :t (*) (*) :: Num a => a
-> a -> a > :t (2*) (2*) :: Num a => a -> a double = 2* dblAll = map (2*)
Data Types data Bool = True | False data Maybe
a = Just a | Nothing data Either a b = Left a | Right b data Tree a = Empty | Node a (Tree a) (Tree b ) • • • •
yesOrNo True = "yes" yesOrNo False = "no" traverse Empty
= [] traverse (Node v l r) = (traverse l) ++ v : traverse r
Laziness fib c n = c : fib n (c
+ n) > fib 0 1 [0, 1, 1, 2, 3, 5, 8, 13, 21 ... > take 5 (fib 0 1) [0, 1, 1, 2, 3]
Laziness > (fib 0 1) !! 900 54877108839480000051413673948383714443800