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
86
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
360
Machine learning: boldly going where Twitter's APIs don't
metabroadcast
0
130
monitoring: it gets better
metabroadcast
1
570
The ABCs of MetaBroadcast APIs
metabroadcast
0
200
APIs for app developers
metabroadcast
1
150
Polishing Varnish
metabroadcast
0
820
Atlas - 3.0 to 4.0
metabroadcast
0
240
Atlas - owl vs deer
metabroadcast
0
240
Storm - an overview
metabroadcast
0
120
Other Decks in Programming
See All in Programming
iOS 26にアップデートすると実機でのHot Reloadができない?
umigishiaoi
0
140
生成AI時代のコンポーネントライブラリの作り方
touyou
1
280
The Evolution of Enterprise Java with Jakarta EE 11 and Beyond
ivargrimstad
0
230
“いい感じ“な定量評価を求めて - Four Keysとアウトカムの間の探求 -
nealle
2
12k
AI駆動のマルチエージェントによる業務フロー自動化の設計と実践
h_okkah
0
220
20250704_教育事業におけるアジャイルなデータ基盤構築
hanon52_
5
1k
TypeScriptでDXを上げろ! Hono編
yusukebe
3
730
Result型で“失敗”を型にするPHPコードの書き方
kajitack
5
1k
DMMを支える決済基盤の技術的負債にどう立ち向かうか / Addressing Technical Debt in Payment Infrastructure
yoshiyoshifujii
3
140
MCPを使ってイベントソーシングのAIコーディングを効率化する / Streamlining Event Sourcing AI Coding with MCP
tomohisa
0
170
型で語るカタ
irof
0
660
Google Agent Development Kit でLINE Botを作ってみた
ymd65536
2
260
Featured
See All Featured
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
Why You Should Never Use an ORM
jnunemaker
PRO
58
9.4k
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
48
2.9k
Typedesign – Prime Four
hannesfritz
42
2.7k
What’s in a name? Adding method to the madness
productmarketing
PRO
23
3.5k
Embracing the Ebb and Flow
colly
86
4.8k
Making Projects Easy
brettharned
116
6.3k
Product Roadmaps are Hard
iamctodd
PRO
54
11k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
233
17k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
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