Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
型付きWebフレームワークで遊んでみた
Search
kokuyouwind
July 14, 2014
Programming
1.9k
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
型付きWebフレームワークで遊んでみた
発表時間5分の社内LT大会で使用した資料です(実名・所属など一部改変)。
OCamlのWebフレームワークOcsigenを使ってみたので、その簡単な紹介となっています。
kokuyouwind
July 14, 2014
More Decks by kokuyouwind
See All by kokuyouwind
疑似コードによるプロンプト記述、どのくらい正確に実行される?
kokuyouwind
0
630
謎解きサイトを Rails SPA で作って RubyKaigi で配布した話
kokuyouwind
0
110
ドメイン指定Cookieとサービス間共有Redisで作る認証基盤サービス
kokuyouwind
0
51
Do LLMs dream of Type Inference?
kokuyouwind
0
57
Let's use LLMs from Ruby 〜 Refine RBS types using LLM 〜
kokuyouwind
0
8.8k
APMをちゃんと使おうとしたら、いつのまにか独自gemを作っていた話
kokuyouwind
0
1k
RBS meets LLMs - Type inference using LLM
kokuyouwind
0
1.1k
オンラインボードゲームを作りたい人生だった
kokuyouwind
0
720
1年間本番運用してわかった、スタートアップこそAWS Copilot CLIを使うべきNつの理由
kokuyouwind
2
12k
Other Decks in Programming
See All in Programming
ActionController meets Protocol Buffers
sorah
1
720
Python Lambdaにおけるテストしやすい設計とAI支援の活用 / Designing Testable Python Lambda Functions with AI
kitano_yuichi
1
210
Modernizing iOS Apps
seyfoyun
0
120
[2026-10-09]一枚の布で作らなくてもいい。 信頼性は「パッチワーク」で紡がれる~既存の運用と新しい可能性をつなぎ合わせてきたCREの話~
tosite
0
110
続・コーディングルールの鮮度を保ちたい / keep-fresh-go-internal-conventions-again
handlename
0
130
Findy - エンジニア向け会社紹介/Findy Company Deck
findyinc
6
400k
graphql-ruby を Spinel で速くしようとした話
mtsmfm
0
120
SFCで実現する病院・医療システムの動的組み立て式UI
koukimiura
1
120
phperだってパンチカードでコーディングしたい
o0h
PRO
0
470
Zero-Tap Sign-In対応、結局何をすればいいの?
mitohato14
0
840
Web Framework Benchmark Battle 2026, Any%
a_matsuda
3
3k
コーディング自動化の次へ。人の介入をゼロにするファクトリーとサポートAIによる実践
timakin
5
4.7k
Featured
See All Featured
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k
How to build a perfect <img>
jonoalderson
1
6.2k
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
600
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
380
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
4
4.4k
Skip the Path - Find Your Career Trail
mkilby
1
260
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
420
Bootstrapping a Software Product
garrettdimon
PRO
306
120k
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
580
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.4k
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
70
67k
Claude Code のすすめ
schroneko
67
230k
Transcript
型付きWebフレームワークで 遊んでみた @kokuyouwind
$ whoami • Web開発 3年目(PHP Only) • Twitter : @kokuyouwind
• ブログ : blog.kokuyouwind.com • ニコニコミュニティ : co1347624 • ポーカー好き このアイコンの人→
先週のハッカソン
テーマ:出会い
出会い → 協調作業
協調作業 → 一緒にお絵かき
お絵かきアプリだ!
デモ http://draw.kokuyouwind.com/
screenshot
普通じゃね?
面白い所: HTMLもJavaScriptも 書いてない!
Haml? TypeScript?
いえいえ
全てOCamlです!
Code on Github https://github.com/kokuyouwind/ocsigen-tutorial ロジック部分は全てOcamlコード graffiti.eliomは150行弱
謝罪
さっきのデモは チュートリアルの丸写しです 正直すまんかった
Ocsigen http://ocsigen.org/
基本記法 {shared{ type message = string }} {client{ let _
= Eliom_lib.alert "Hello!" }} let main_service = (* ... *) 共通コード クライアントコード サーバーコード
サービス定義 let main_service = Eliom_registration.Html5.register_service ~path:[“hello"] ~get_params:Eliom_parameter.unit (fun () ()
-> Lwt.return (html (head (title (pcdata “hello")) []) (body [h1 [pcdata “hello, world!"]]))) Html型の値を生成
サービス定義 let main_service = Eliom_registration.Html5.register_service ~path:["graff"] ~get_params:Eliom_parameter.unit (fun () ()
-> Lwt.return (html (head (title (pcdata "Page title")) []) (body [ul [pcdata "Graffiti"]]))) ↑コンパイル時に型エラー (ulの子要素がliじゃない)
サーバー変数埋め込み let message = “hello” {client{ let _ = Eliom_lib.alert
“%s” %message }} ↑ %hogeでサーバー側の 変数を参照
サーバー変数埋め込み let message = 0 {client{ let _ = Eliom_lib.alert
“%s” %message }} ↑ Stringじゃないので エラーになる
サーバー変数埋め込み let message = 0 {client{ let _ = Eliom_lib.alert
“%s” (string_of_int %message) }} ↑ これならオーケー
他にも… • Bus, React – イベントをやりとりする – 前者がEvent Driven, 後者がReactive
– 型が合わないとコンパイル時にエラー • Ajaxでのjsonとかの呼び出し – service定義を参照してurlを生成 – 型が合わないとコンパイル時にエラー
まとめ • Ocsigenだと全部Ocamlで書ける • コンパイル時点で型起因のバグは弾く • コードが割と短くなる • 学習コストは結構高い •
名古屋こわい • ことりちゃんかわいい http://tkotori.github.io/
終わり from @mzp
以下予備スライド
Ocsigenプロジェクト • OcsigenServer : Webサーバ • Eliom : Webフレームワーク •
Js_of_ocaml : JSコンパイラ • Lwt : 並列計算ライブラリ • 他色々 – http://ocsigen.org/overview/framework
ページサイズ • HTML : 3.39KB – 通信用の識別子とかが埋め込まれている • JavaScript :
282.39KB – OCamlバイトコード => JavaScriptコード – 直接読むのは多分辛い – 実行はかなり高速らしい • VM実行OCamlよりも速い場合があるとのこと
ことりちゃん? • 高階ことり • モナドの薄い本のイメージキャラクター – @dico_lequeさんの本(予定) – @bleisさんと@mzpさんの差し金 •
ことりちゃん可愛い • http://tkotori.github.io/
参考 • Ocsigenプロジェクトページ – http://ocsigen.org/ • OCamlで構築するモダンWeb – http://proofcafe.org/~keigoi/pplss2012- ocaml.pdf
• OCamlで作ったWebアプリをHerokuで 動かす方法(2) – http://mzp.hatenablog.com/entry/2013/06 /08/003029