Suche senden
Hochladen
Haskell Night: LT モナドで作る正規表現コンビネータライブラリ
•
0 gefällt mir
•
893 views
Akihiro Harai
Folgen
2009年11月20日に行われた「Haskell Night」において発表されたスライド。
Weniger lesen
Mehr lesen
Technologie
Melden
Teilen
Melden
Teilen
1 von 15
Jetzt herunterladen
Downloaden Sie, um offline zu lesen
Empfohlen
新宿Scala座2014 3月号スライド
新宿Scala座2014 3月号スライド
cosmo0920
ClojureとEPUBで「普通のやつらの上を行く」方法
ClojureとEPUBで「普通のやつらの上を行く」方法
del tam
多値で簡単パーサーコンビネーター
多値で簡単パーサーコンビネーター
Keiichiro Shikano
50分でわかるブループリントについて
50分でわかるブループリントについて
Masahiko Nakamura
Java EE勉強会 開発合宿 成果発表
Java EE勉強会 開発合宿 成果発表
Akihiro Harai
2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
Marius Sescu
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Expeed Software
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
Empfohlen
新宿Scala座2014 3月号スライド
新宿Scala座2014 3月号スライド
cosmo0920
ClojureとEPUBで「普通のやつらの上を行く」方法
ClojureとEPUBで「普通のやつらの上を行く」方法
del tam
多値で簡単パーサーコンビネーター
多値で簡単パーサーコンビネーター
Keiichiro Shikano
50分でわかるブループリントについて
50分でわかるブループリントについて
Masahiko Nakamura
Java EE勉強会 開発合宿 成果発表
Java EE勉強会 開発合宿 成果発表
Akihiro Harai
2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
Marius Sescu
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Expeed Software
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
Skeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
Introduction to Data Science
Introduction to Data Science
Christy Abraham Joy
Time Management & Productivity - Best Practices
Time Management & Productivity - Best Practices
Vit Horky
The six step guide to practical project management
The six step guide to practical project management
MindGenius
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Applitools
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
GetSmarter
ChatGPT webinar slides
ChatGPT webinar slides
Alireza Esmikhani
Weitere ähnliche Inhalte
Empfohlen
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
Skeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
Introduction to Data Science
Introduction to Data Science
Christy Abraham Joy
Time Management & Productivity - Best Practices
Time Management & Productivity - Best Practices
Vit Horky
The six step guide to practical project management
The six step guide to practical project management
MindGenius
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Applitools
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
GetSmarter
ChatGPT webinar slides
ChatGPT webinar slides
Alireza Esmikhani
Empfohlen
(20)
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
Skeleton Culture Code
Skeleton Culture Code
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Getting into the tech field. what next
Getting into the tech field. what next
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
How to have difficult conversations
How to have difficult conversations
Introduction to Data Science
Introduction to Data Science
Time Management & Productivity - Best Practices
Time Management & Productivity - Best Practices
The six step guide to practical project management
The six step guide to practical project management
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
ChatGPT webinar slides
ChatGPT webinar slides
Haskell Night: LT モナドで作る正規表現コンビネータライブラリ
1.
モナドで作る 正規表現コンビネータライブラリ Akihiro HARAI
2.
自己紹介 Haskell を知ったのは 「ふつける」が出る半年くらい前 2005 年末くらい? Java
で必ず final を付ける 自分の性格によくマッチ 原井 彰弘 (はらい あきひろ)
3.
モナドを使った正規表現 コンビネータライブラリ
4.
きっかけ その 1 内部
DSL では 無理? GHC 付属の正規表現ライブラリが 正規表現を「文字列」として扱うことに不満
5.
きっかけ その 2 Yet
Another Haskell Tutorial Chapter 9 "Monads" 119 ページ 「 Haskell のグルになりたい者のみモナドを作れ」 「されど、モナドの作り方が分かれば Haskell ライフ はより豊かになるだろう」
6.
モナドを使って Parsec っぽい 正規表現コンビネータを作れば 一挙両得??
7.
モナドの能力的に可能か? バックトラックは? 後方参照は?
8.
モナドの能力的に可能か? バックトラックは? 後方参照は? 従来型 NFA ならば リストと遅延評価を使って自然に書ける 言語内
DSL のメリットを生かせば 自由自在
9.
こんな感じに使います testRegex :: Regex
() testRegex = do rxCaret (matched, val) <- rxStar $ do rxOneChar 'a' rxOneChar 'b' rxOneChar 'c' rxOneChar 'd' rxDollar return () わかりやすさ重視のため 冗長性には目をつぶってください・・・ /^(ab)*cd $/ rxStar 以下で マッチした文字列 rxStar から返される 任意の値
10.
実演
11.
メリットとデメリット メリット デメリット 強い静的型付け 表現の再利用が容易 表現の動的な作成と変更が可能 (文字列ではなく)任意のトークン列への 適用が可能(未実装) 記述が冗長 最適化は Haskell コンパイラ依存
12.
実装(一部) newtype Regex a
= Rx { runRegex :: (RxTarget -> [(RxTarget, a)]) } data RxTarget = RxTarget { rxTargetBefore :: String, -- 逆順 rxTargetMatched :: String, -- 逆順 rxTargetAfter :: String } instance Monad Regex where m >>= next = Rx $ target -> let thisCand = runRegex m target getNextCand (target', a) = runRegex (next a) tar get' in concatMap getNextCand thisCand return a = Rx $ target -> [(target, a)]
13.
実装ずみの機能 ^ $ *
( ) *? . | [ ] 後方参照など モナドで全部できる!
14.
モナドってすごい! Haskell ってすごい!
15.
ご清聴ありがとうございました
Jetzt herunterladen