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
2
1.1k
하스켈과 타입
하스켈과 타입에 대해 설명합니다.
2015년 4월 4일 하스켈 프로그래밍 다섯번째 모임
http://haskell.kr/meetup/2015-04-04/
Hong Minhee (洪 民憙)
April 04, 2015
Tweet
Share
More Decks by Hong Minhee (洪 民憙)
See All by Hong Minhee (洪 民憙)
Fedify — ActivityPub 서버 프레임워크
minhee
1
14
여러 .NET 구현과 플랫폼을 두루 지원하는 라이브러리 (오픈 소스로) 만들기
minhee
3
1k
첫 이더리움 스마트 콘트랙트 개발 이야기
minhee
1
1.2k
파이썬과 다이아스포라
minhee
3
2.2k
Python and Diaspora
minhee
2
400
RPC 프레임워크 제작 삽질기
minhee
7
2.5k
All docs lead to Sphinx
minhee
3
6.5k
유니코드 스터디
minhee
9
2.2k
Geofront 개발 후기: Python 2와 작별하고 Python 3로 개발하기
minhee
11
3k
Other Decks in Programming
See All in Programming
CSC509 Lecture 14
javiergs
PRO
0
130
htmxって知っていますか?次世代のHTML
hiro_ghap1
0
330
事業成長を爆速で進めてきたプロダクトエンジニアたちの成功談・失敗談
nealle
3
1.4k
第5回日本眼科AI学会総会_AIコンテスト_3位解法
neilsaw
0
170
あれやってみてー駆動から成長を加速させる / areyattemite-driven
nashiusagi
1
200
「Chatwork」Android版アプリを 支える単体テストの現在
okuzawats
0
180
短期間での新規プロダクト開発における「コスパの良い」Goのテスト戦略」 / kamakura.go
n3xem
2
160
命名をリントする
chiroruxx
1
380
HTTP compression in PHP and Symfony apps
dunglas
2
1.7k
Stackless и stackful? Корутины и асинхронность в Go
lamodatech
0
610
menu基盤チームによるGoogle Cloudの活用事例~Application Integration, Cloud Tasks編~
yoshifumi_ishikura
0
110
SymfonyCon Vienna 2025: Twig, still relevant in 2025?
fabpot
3
1.2k
Featured
See All Featured
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
1.9k
Done Done
chrislema
181
16k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
28
900
The World Runs on Bad Software
bkeepers
PRO
65
11k
Art, The Web, and Tiny UX
lynnandtonic
298
20k
Scaling GitHub
holman
458
140k
Bash Introduction
62gerente
608
210k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Documentation Writing (for coders)
carmenintech
66
4.5k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
Agile that works and the tools we love
rasmusluckow
328
21k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
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