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
선언형 UI에서의 상태관리
l2hyunwoo
0
170
Zoneless Testing
rainerhahnekamp
0
120
コンテナをたくさん詰め込んだシステムとランタイムの変化
makihiro
1
130
【re:Growth 2024】 Aurora DSQL をちゃんと話します!
maroon1st
0
780
Итераторы в Go 1.23: зачем они нужны, как использовать, и насколько они быстрые?
lamodatech
0
790
KMP와 kotlinx.rpc로 서버와 클라이언트 동기화
kwakeuijin
0
140
Webエンジニア主体のモバイルチームの 生産性を高く保つためにやったこと
igreenwood
0
340
Effective Signals in Angular 19+: Rules and Helpers
manfredsteyer
PRO
0
100
責務を分離するための例外設計 - PHPカンファレンス 2024
kajitack
6
1.1k
開発者とQAの越境で自動テストが増える開発プロセスを実現する
92thunder
1
190
各クラウドサービスにおける.NETの対応と見解
ymd65536
0
100
テスト自動化失敗から再挑戦しチームにオーナーシップを委譲した話/STAC2024 macho
ma_cho29
1
1.3k
Featured
See All Featured
Site-Speed That Sticks
csswizardry
2
190
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
48
2.2k
Six Lessons from altMBA
skipperchong
27
3.5k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
247
1.3M
Building Applications with DynamoDB
mza
91
6.1k
Raft: Consensus for Rubyists
vanstee
137
6.7k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
17
2.3k
Mobile First: as difficult as doing things right
swwweet
222
9k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
2
290
Building an army of robots
kneath
302
44k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
1.2k
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