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
MetaBroadcast
June 13, 2012
Programming
0
94
Haskell - A brief introduction
Talk given by Fred van den Driessche on 13-06-2012 at MetaBroadcast.
MetaBroadcast
June 13, 2012
Tweet
Share
More Decks by MetaBroadcast
See All by MetaBroadcast
PhotoGlut
metabroadcast
2
370
Machine learning: boldly going where Twitter's APIs don't
metabroadcast
0
130
monitoring: it gets better
metabroadcast
1
580
The ABCs of MetaBroadcast APIs
metabroadcast
0
220
APIs for app developers
metabroadcast
1
150
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
CSC307 Lecture 05
javiergs
PRO
0
500
CSC307 Lecture 06
javiergs
PRO
0
690
コマンドとリード間の連携に対する脅威分析フレームワーク
pandayumi
1
460
開発者から情シスまで - 多様なユーザー層に届けるAPI提供戦略 / Postman API Night Okinawa 2026 Winter
tasshi
0
200
FOSDEM 2026: STUNMESH-go: Building P2P WireGuard Mesh Without Self-Hosted Infrastructure
tjjh89017
0
170
Implementation Patterns
denyspoltorak
0
290
責任感のあるCloudWatchアラームを設計しよう
akihisaikeda
3
180
そのAIレビュー、レビューしてますか? / Are you reviewing those AI reviews?
rkaga
6
4.6k
humanlayerのブログから学ぶ、良いCLAUDE.mdの書き方
tsukamoto1783
0
200
AI巻き込み型コードレビューのススメ
nealle
2
360
MUSUBIXとは
nahisaho
0
130
Apache Iceberg V3 and migration to V3
tomtanaka
0
160
Featured
See All Featured
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
280
SEO for Brand Visibility & Recognition
aleyda
0
4.2k
Git: the NoSQL Database
bkeepers
PRO
432
66k
A better future with KSS
kneath
240
18k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.3k
Optimizing for Happiness
mojombo
379
71k
Navigating Weather and Climate Data
rabernat
0
110
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
2.1k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
310
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Designing for Performance
lara
610
70k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.3k
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