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
85
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
140
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
ペアプロ × 生成AI 現場での実践と課題について / generative-ai-in-pair-programming
codmoninc
0
230
dbt民主化とLLMによる開発ブースト ~ AI Readyな分析サイクルを目指して ~
yoshyum
2
240
GitHub Copilot and GitHub Codespaces Hands-on
ymd65536
1
130
WindowInsetsだってテストしたい
ryunen344
1
220
Go1.25からのGOMAXPROCS
kuro_kurorrr
1
840
エンジニア向け採用ピッチ資料
inusan
0
180
Blazing Fast UI Development with Compose Hot Reload (droidcon New York 2025)
zsmb
1
280
すべてのコンテキストを、 ユーザー価値に変える
applism118
2
1.1k
既存デザインを変更せずにタップ領域を広げる方法
tahia910
1
260
システム成長を止めない!本番無停止テーブル移行の全貌
sakawe_ee
1
150
Hypervel - A Coroutine Framework for Laravel Artisans
albertcht
1
110
童醫院敏捷轉型的實踐經驗
cclai999
0
210
Featured
See All Featured
The World Runs on Bad Software
bkeepers
PRO
69
11k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.4k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
3.9k
A better future with KSS
kneath
239
17k
Git: the NoSQL Database
bkeepers
PRO
430
65k
Mobile First: as difficult as doing things right
swwweet
223
9.7k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
34
5.9k
Making Projects Easy
brettharned
116
6.3k
A Tale of Four Properties
chriscoyier
160
23k
Become a Pro
speakerdeck
PRO
28
5.4k
Facilitating Awesome Meetings
lara
54
6.4k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
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