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
하스켈과 타입
Search
Hong Minhee (洪 民憙)
April 04, 2015
Programming
1.2k
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
하스켈과 타입
하스켈과 타입에 대해 설명합니다.
2015년 4월 4일 하스켈 프로그래밍 다섯번째 모임
http://haskell.kr/meetup/2015-04-04/
Hong Minhee (洪 民憙)
April 04, 2015
More Decks by Hong Minhee (洪 民憙)
See All by Hong Minhee (洪 民憙)
Gukhanmun: 國漢文을 한글로 바꾸기
minhee
0
24
Nobody's job, everybody's problem: F/OSS in the age of AI
minhee
0
35
Fedify: Building ActivityPub servers without the pain
minhee
0
38
Optique: TypeScript의 타입 추론으로 CLI 유효성 검사를 대체하기
minhee
0
52
야크 셰이빙: 새로운 오픈 소스의 원동력
minhee
0
56
Embracing yak shaving
minhee
1
48
BotKit by Fedify:誰でも簡単に作れるActivityPubボット
minhee
0
190
国漢文混用体からHolloまで
minhee
2
660
Fedify — ActivityPub 서버 프레임워크
minhee
1
100
Other Decks in Programming
See All in Programming
「正の参照」と 「負の導出」で組む ハーネスエンジニアリング
cottpan
1
120
Haskell/Servantを通してWebミドルウェアを捉え直す
pizzacat83
0
400
壊れたパーサから始める関数型設計と構成的なパーサ #fp_matsuri
raiga0310
2
170
Dataformのリポジトリを立ち上げるときにまずやること / dataform-day0-2026
snhryt
0
210
AIエージェントで 変わるAndroid開発環境
takahirom
1
440
任せる範囲はこう広がった / How the Scope of AI Delegation Has Expanded
nrslib
1
240
キャリア迷子上等 ─ "ない道"は自分で作ればいい
16bitidol
3
2.8k
LLM本来の能力を解き放つサンドボックス技術とAI民主化への適用
yukukotani
3
4.9k
Generative UI & AI-Assistants for Your Angular Solutions
manfredsteyer
PRO
0
130
Developing with AI Agents — Codex, Claude Code & Cowork Practical Guide
x5gtrn
PRO
0
1.3k
エンジニアにデザインハーネスを 〜デザインプロセスを規定するためのハーネス〜 / Design harness from an engineer's perspective
rkaga
2
910
気圧・高度・GPSを記録&可視化するアプリ「Koudo」を作った話
hjmkth
1
340
Featured
See All Featured
RailsConf 2023
tenderlove
30
1.5k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Docker and Python
trallard
47
3.9k
Information Architects: The Missing Link in Design Systems
soysaucechin
0
1k
Between Models and Reality
mayunak
4
360
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
55k
Utilizing Notion as your number one productivity tool
mfonobong
4
340
Faster Mobile Websites
deanohume
310
32k
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
460
Un-Boring Meetings
codingconduct
0
330
The Limits of Empathy - UXLibs8
cassininazir
1
390
AI Search: Where Are We & What Can We Do About It?
aleyda
0
7.7k
Transcript
ೞझுҗ ఋੑ ഘ൞ http://hongminhee.org/
Data type • օܻ ॳח ߣয: ܐഋ • ୶ஏೡ ࣻ
٠, ܐ(data)ܳ ࠙ܨ(type)ೞח Ѫ • Ӓۢ ࠙ܨೠ ܐٜ যڌѱ ࢤӟ Ѫੌө?
Value • օܻ ॳח ߣয: ч • য٥оী ഃࢲ աী
੍൧ ࣻ • ଃীࢲ ଃਵ۽ ೧ ࣻ
Value • օܻ ॳח ߣয: ч • ݫݽܻա ٣झী ೞҊ
աী ৌযࠅ ࣻ • ֎ਕܳ ా೧ ࣠ؼ ࣻ
Value • օܻ ॳח ߣয: ч • ܴয ࣻب Ҋ,
ܴ যڃ чਸ ڷೞחب ঌ ࣻ • ೣࣻ ੋ۽ ٜযт ࣻب Ҋ, ೣࣻ۽ࠗఠ աৢ ࣻب
ч > let factorial n = product [1..n] > let
x = 10 > factorial x 3628800
ܴয ࣻ > let factorial n = product [1..n]
> let x = 10 > factorial x 3628800
ܴ ڷਸ ঌ ࣻ > let factorial n =
product [1..n] > let x = 10 > factorial x 3628800
ೣࣻ ੋ۽ ٜযт ࣻ > let factorial n =
product [1..n] > let x = 10 > factorial x 3628800
ೣࣻ۽ࠗఠ աৢ ࣻ > let factorial n = product
[1..n] > let x = 10 > factorial x 3628800
ч ࢿ • чٜ ݃ ةౠೠ ࢿ • 1
? 2. Ӓۢ 2 ? 3. • ['a', 'b', 'c'] ӡח? 3. • [] ? ݾ۾ೠప ‘’ۆ ަө? • 1 ӡח? ࣻೠప ‘ӡ’ۆ ަө?
ч ࢿ > succ 1 2 > succ 2 3
> length ['a', 'b', 'c'] 3
ч ࢿ > succ ['a', 'b', 'c'] <interactive>:16:1: No instance
for (Enum [Char]) arising from a use of ‘succ’ In the expression: succ ['a', 'b', 'c'] In an equation for ‘it’: it = succ ['a', 'b', 'c']
ч ࢿ > length 1 <interactive>:17:8: No instance for (Num
[a0]) arising from the literal ‘1’ In the first argument of ‘length’, namely ‘1’ In the expression: length 1 In an equation for ‘it’: it = length 1
ܐഋ • чٜ ݃ ةౠೠ ࢿ • Ӓ۞ա ࢿ
൚ࢎೠ Ѫՙܻ ݽইࢲ ࠙ܨೡ ࣻ • ‘’ Ҋ, ف ч ‘’ чٜ ‘эਵݶ’ ف ч ‘эҊ’, ‘؊ೡ ࣻ’ Ҋ, ‘ࡓ ࣻ’ب Ҋ… → ࣻ ܐഋ • 0ѐ ࢚ чਸ ‘ನೣ’ೡ ࣻ Ҋ, ನೣػ чٜ ࢎী ‘ࣽࢲ’ о Ҋ… → ݾ۾ ܐഋ
ܐഋ • ࠺तೠ ࢿ чٜਸ ݽইفݶ ಞܻೞ • о۸, ؔࣅਸ
ೡ ٸ ‘؊ೡ ࣻ ח’ ࢿ чٜ݅ ߉Ҋ र → ࣻ ܐഋ݅ ߉ਵݶ ػ • о۸, іࣻܳ ҳೡ ٸ ‘чਸ ನೣೡ ࣻ ח’ ࢿ чٜ݅ ߉Ҋ र → ݾ۾ ܐഋ݅ ߉ਵݶ ػ
factorial ࣻ݅ ߉ח > factorial ['a', 'b', 'c'] <interactive>:26:1: No
instance for (Num [Char]) arising from a use of ‘factorial’ In the expression: factorial ['a', 'b', 'c'] In an equation for ‘it’: it = factorial ['a', 'b', 'c']
ч ܐഋ (पઁח ࠁ ખ؊ ࠂפ) > let factorial n
= product ([1..n] :: [Integer]) :: Integer > let x = 10 :: Integer > factorial x :: Integer 3628800 :: Integer
ܐഋ ঌইࠁӝ (पઁח ࠁ ખ؊ ࠂפ) > :t x x
:: Integer > :t factorial factorial :: Integer -> Integer
ৈӝࢶ ܖ ঋח ઁ • ࣻ ܐഋ (algebraic data
type) • Parametric polymorphism • ఋੑېझ (typeclass) • ⊥ (bottom) • ӝఋ ١١. ೞ݅ ށۄب ੌױ ೞझு ٬ द оמ
ࠗप೧ࢲ દ࣠פ bit.ly/haskell-kr-2015-04-04-type