Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
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
13
여러 .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
気をつけたい!Desktop対応で陥りやすい罠とその対策
goto_tsl
0
200
CSC305 Lecture 25
javiergs
PRO
0
120
Semantic Kernelのネイティブプラグインで知識拡張をしてみる
tomokusaba
0
100
Keeping it Ruby: Why Your Product Needs a Ruby SDK - RubyWorld 2024
envek
0
120
romajip: 日本の住所CSVデータを活用した英語住所変換ライブラリを作った話
sangunkang
0
2.4k
事業成長を爆速で進めてきたプロダクトエンジニアたちの成功談・失敗談
nealle
3
1.3k
flutterkaigi_2024.pdf
kyoheig3
0
470
カンファレンスの「アレ」Webでなんとかしませんか? / Conference “thing” Why don't you do something about it on the Web?
dero1to
2
160
Seamless Flutter Native Integration: FFI & Pigeon - Dreamwalker (JaichangPark / 박제창) @FlutterKaigi2024
itsmedreamwalker
0
120
あれやってみてー駆動から成長を加速させる / areyattemite-driven
nashiusagi
1
160
DevTools extensions で 独自の DevTool を開発する | FlutterKaigi 2024
kokiyoshida
0
450
ソフトウェアの振る舞いに着目し 複雑な要件の開発に立ち向かう
rickyban
0
830
Featured
See All Featured
The Cult of Friendly URLs
andyhume
78
6.1k
Building Better People: How to give real-time feedback that sticks.
wjessup
365
19k
VelocityConf: Rendering Performance Case Studies
addyosmani
326
24k
Documentation Writing (for coders)
carmenintech
65
4.5k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
Music & Morning Musume
bryan
46
6.2k
The Pragmatic Product Professional
lauravandoore
32
6.3k
Practical Orchestrator
shlominoach
186
10k
Reflections from 52 weeks, 52 projects
jeffersonlam
346
20k
Git: the NoSQL Database
bkeepers
PRO
427
64k
What's in a price? How to price your products and services
michaelherold
243
12k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.8k
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