SlideShare a Scribd company logo
λ          WxHaskell
λλ




                 inajob
     http://d.hatena.ne.jp/inajob/
λ                        wxWidgets
λλ
●   クロスプラットホームなGUIツールキット
    –   単にGUIのセットだけではなく通信や文字列操作、ファイル
        管理も行うことが出来る欲張りなライブラリ
    –   C++で記述されているが様々な言語から利用可能
         ●   wxPython,wxPerl,WxHaskell...
●   類似品
    –   Gtk
    –   Tk
    –   Qt
    –   Swing
λ                                     Haskell
λλ
●   純関数型言語
    –   正直なところ何が出来るのかとか僕は理解していない
    –   Haskellを理解するためにGUIアプリケーションを作ってみる
●   WxHaskell
    –   HaskellからwxWidgetsを操作するためのラッパライブラリ
    –   これでHaskellを使ってGUIアプリケーションが作れる
main = putStrLn “Hello world”

        main = putStrLn $ show 2008
        main = putStrLn (show 2008)
λ                   日本語
λλ
●   ソースコードにutf8を使うと日本語を表示できる
    –   ソースコード中の文字を自動でUCS4に変換する
●   読み込んだデータを表示する
    –   そのままだと文字化けする
    –   hogehoge⇒UCS4 変換を利用する
                 (hogehoge:読み込んだデータの文字コード)
λ                    初めてのWindow
λλ
    import Graphics.UI.WX

    main = start mainFrame

    mainFrame = do
      f <- frameFixed [text := quot;はろー Worldquot;]
      p <- panel f []
      set f [layout := minsize (sz 300 300) $ widget p]

●    いきなりdo
      –   GUIを扱う命令はIOなので仕方がないです
●    := でプロパティを設定可能
λ                   初めてのWindow2
λλ
    import Graphics.UI.WX

    main = start mainFrame

    mainFrame = do
      s <- readFile “title.txt”
      f <- frameFixed [text := utf8ToUcs4 s]
      p <- panel f []
      set f [layout := minsize (sz 300 300) $ widget p]

●    外部データをGUIに表示する時は変換関数を通す
λ                  はじめてのレイアウト
λλ
    mainFrame = do
      f <- frame [text := quot;titlequot;]
      p <- panel f []
      b <- button p [text := quot;pushquot;]
      i <- textEntry p[text := quot;aquot;]
      set p [layout := (row 2 [fill$widget i,widget b])]
      set f [layout := (fill $ widget p)]

●    button,textEntry
●    widget,row,column,fill,等でレイアウトを整える
      –   リサイズに耐える設計
●    親をちゃんと指定しましょう
λ                     もっとレイアウト
λλ
    mainFrame = do
      f <- frame [text := quot;titlequot;]
      p <- panel f []
      b <- button p [text := quot;pushquot;]
      i <- textEntry p[text := quot;aquot;]
      l <- singleListBox p [items := [quot;inaquot;,quot;jobquot;,quot;kpcquot;]];
      set p [layout :=(column 2 [
                       (row 2 [fill$widget i,widget b]),
                       fill$widget l
                       ])]
      set f [layout := (fill $ widget p)]
●    singleListBox
λ                            イベント
λλ
    mainFrame = do
      f <- frame [text := quot;titlequot;]
      p <- panel f []
      b <- button p [text := quot;pushquot;,on command ::= buttonEv]
      i <- textEntry p [text := quot;aquot;]
      set p [layout := (row 2 [fill$widget i,widget b])]
      set f [layout := (fill $ widget p)]

    buttonEv w = showDialog quot;helloquot; quot;worldquot; w

    showDialog:: String -> String -> Window a -> IO ()
    showDialog msg title parent = do
               mesd <- messageDialogCreate parent msg title wxOK
               messageDialogShowModal mesd
               messageDialogDelete mesd

●    クリックされると関数が呼び出される
λ               マルチスレッドとチャンネル
λλ
mainFrame = do
 eventsChan <- newChan        --MultiThread Queue
 f <- frame [text := quot;titlequot;]
 p <- panel f []
 i <- textEntry p [text := quot;aquot;]
 b <- button p [text:=quot;pushquot;,on command::=buttonEv i eventsChan]
 set p [layout := (row 2 [fill$widget i,widget b])]
 set f [layout := (fill $ widget p)]
 timer <- windowTimerCreate f
 timerOnCommand timer (onTimer eventsChan i)
 timerStart timer 500 False

onTimer chan i = do
                  noEvents <- isEmptyChan chan
                  if noEvents then return ()
                               else do
                                       str <- readChan chan;
                                       set i [text := show$str]
buttonEv i chan w= do
                  forkOS child
                  set i [text:= quot;startquot;]
    where
        child = writeChan chan $fact 1000000
fact n=foldl' (*) 1 [1..n]
 ●
     別スレッドからの信号をタイマーで受け取る
      –   (重い計算をするとどっち道固まったorz)
λ       Twitterクライアントを書いてみた
λλ
●   一応かけた
●   良かったこと
    –   JSONのパーサをいじるのが楽だった
    –   必要かどうか不明な通信を遅延評価で隠蔽
        (unsafePerformIOの利用)
●   悪かったこと
    –   GUI周りはとても手続き的
    –   通信も手続き的
    –   コンパイルである程度バグが取れるが、それ以降のデバッ
        グがやりにくい
●   http://d.hatena.ne.jp/inajob/20081005
λ              まとめ
λλ
●   GUIは手続き型言語に任せて
●   パーサやアルゴリズムのコアの部分をHaskellで記述
    するのがよさそう

More Related Content

What's hot

Salooni march april 2013
Salooni march april 2013Salooni march april 2013
Salooni march april 2013
indianislamicmag
 
【12-B-4】 並列処理開発を支援するコンパイラの機能
【12-B-4】 並列処理開発を支援するコンパイラの機能【12-B-4】 並列処理開発を支援するコンパイラの機能
【12-B-4】 並列処理開発を支援するコンパイラの機能devsumi2009
 
使いこなそうGUC
使いこなそうGUC使いこなそうGUC
使いこなそうGUC
Akio Ishida
 
20090418 イケテルRails勉強会 第2部Air編
20090418 イケテルRails勉強会 第2部Air編20090418 イケテルRails勉強会 第2部Air編
20090418 イケテルRails勉強会 第2部Air編
mochiko AsTech
 
GAE/J 開発環境でJDO入門
GAE/J 開発環境でJDO入門GAE/J 開発環境でJDO入門
GAE/J 開発環境でJDO入門
bose999
 
PostgreSQLで学ぶBoyer-Moore-Horspoolアルゴリズム
PostgreSQLで学ぶBoyer-Moore-HorspoolアルゴリズムPostgreSQLで学ぶBoyer-Moore-Horspoolアルゴリズム
PostgreSQLで学ぶBoyer-Moore-Horspoolアルゴリズム
Akio Ishida
 
Boo Programming Language
Boo Programming LanguageBoo Programming Language
Boo Programming Language
Vitaly Baum
 
PMT-006-生產計劃與管理
PMT-006-生產計劃與管理PMT-006-生產計劃與管理
PMT-006-生產計劃與管理handbook
 
三星上將梨
三星上將梨三星上將梨
三星上將梨Jaing Lai
 
Why The Us Wants War 080702
Why The Us Wants War  080702Why The Us Wants War  080702
Why The Us Wants War 080702Chui-Wen Chiu
 
انقلاب 2000
انقلاب 2000انقلاب 2000
انقلاب 2000
Noor Khaliq Noor
 
Historia das tic
Historia das ticHistoria das tic
Historia das ticfilipereira
 

What's hot (19)

Salooni march april 2013
Salooni march april 2013Salooni march april 2013
Salooni march april 2013
 
Test
TestTest
Test
 
【12-B-4】 並列処理開発を支援するコンパイラの機能
【12-B-4】 並列処理開発を支援するコンパイラの機能【12-B-4】 並列処理開発を支援するコンパイラの機能
【12-B-4】 並列処理開発を支援するコンパイラの機能
 
使いこなそうGUC
使いこなそうGUC使いこなそうGUC
使いこなそうGUC
 
20090418 イケテルRails勉強会 第2部Air編
20090418 イケテルRails勉強会 第2部Air編20090418 イケテルRails勉強会 第2部Air編
20090418 イケテルRails勉強会 第2部Air編
 
Test
TestTest
Test
 
GAE/J 開発環境でJDO入門
GAE/J 開発環境でJDO入門GAE/J 開発環境でJDO入門
GAE/J 開発環境でJDO入門
 
Power point print - quizizz
Power point   print - quizizzPower point   print - quizizz
Power point print - quizizz
 
PostgreSQLで学ぶBoyer-Moore-Horspoolアルゴリズム
PostgreSQLで学ぶBoyer-Moore-HorspoolアルゴリズムPostgreSQLで学ぶBoyer-Moore-Horspoolアルゴリズム
PostgreSQLで学ぶBoyer-Moore-Horspoolアルゴリズム
 
.-Instruction-.-
 .-Instruction-.- .-Instruction-.-
.-Instruction-.-
 
Boo Programming Language
Boo Programming LanguageBoo Programming Language
Boo Programming Language
 
PMT-006-生產計劃與管理
PMT-006-生產計劃與管理PMT-006-生產計劃與管理
PMT-006-生產計劃與管理
 
Matemática - Segundo Ciclo - Actividades - Nivel Primario
Matemática - Segundo Ciclo - Actividades - Nivel PrimarioMatemática - Segundo Ciclo - Actividades - Nivel Primario
Matemática - Segundo Ciclo - Actividades - Nivel Primario
 
三星上將梨
三星上將梨三星上將梨
三星上將梨
 
Test5
Test5Test5
Test5
 
Test
TestTest
Test
 
Why The Us Wants War 080702
Why The Us Wants War  080702Why The Us Wants War  080702
Why The Us Wants War 080702
 
انقلاب 2000
انقلاب 2000انقلاب 2000
انقلاب 2000
 
Historia das tic
Historia das ticHistoria das tic
Historia das tic
 

Viewers also liked

サンドボックス化によるセキュアなプログラミング
サンドボックス化によるセキュアなプログラミングサンドボックス化によるセキュアなプログラミング
サンドボックス化によるセキュアなプログラミング
Yikei Lu
 
Qt のコミュニティと日本語での情報発信②
Qt のコミュニティと日本語での情報発信②Qt のコミュニティと日本語での情報発信②
Qt のコミュニティと日本語での情報発信②
Yikei Lu
 
Qtおやつ部
Qtおやつ部Qtおやつ部
Qtおやつ部
hermit4 Ishida
 
Cres Theodoro Hertzl
Cres Theodoro  HertzlCres Theodoro  Hertzl
Cres Theodoro Hertzlhellenrz
 
QML上にOpenGLのカスタムエレメントを表示する
QML上にOpenGLのカスタムエレメントを表示するQML上にOpenGLのカスタムエレメントを表示する
QML上にOpenGLのカスタムエレメントを表示する
nobo66
 
QtとC++でGUIプログラミング
QtとC++でGUIプログラミングQtとC++でGUIプログラミング
QtとC++でGUIプログラミング
seanchas_t
 
PyQtではじめるGUIプログラミング
PyQtではじめるGUIプログラミングPyQtではじめるGUIプログラミング
PyQtではじめるGUIプログラミング
Ransui Iso
 

Viewers also liked (7)

サンドボックス化によるセキュアなプログラミング
サンドボックス化によるセキュアなプログラミングサンドボックス化によるセキュアなプログラミング
サンドボックス化によるセキュアなプログラミング
 
Qt のコミュニティと日本語での情報発信②
Qt のコミュニティと日本語での情報発信②Qt のコミュニティと日本語での情報発信②
Qt のコミュニティと日本語での情報発信②
 
Qtおやつ部
Qtおやつ部Qtおやつ部
Qtおやつ部
 
Cres Theodoro Hertzl
Cres Theodoro  HertzlCres Theodoro  Hertzl
Cres Theodoro Hertzl
 
QML上にOpenGLのカスタムエレメントを表示する
QML上にOpenGLのカスタムエレメントを表示するQML上にOpenGLのカスタムエレメントを表示する
QML上にOpenGLのカスタムエレメントを表示する
 
QtとC++でGUIプログラミング
QtとC++でGUIプログラミングQtとC++でGUIプログラミング
QtとC++でGUIプログラミング
 
PyQtではじめるGUIプログラミング
PyQtではじめるGUIプログラミングPyQtではじめるGUIプログラミング
PyQtではじめるGUIプログラミング
 

Similar to WxHaskell

20090418 イケテルRails勉強会 第2部Air編 解説
20090418 イケテルRails勉強会 第2部Air編 解説20090418 イケテルRails勉強会 第2部Air編 解説
20090418 イケテルRails勉強会 第2部Air編 解説
mochiko AsTech
 
技術トレンディセミナー フレームワークとしてのTrac
技術トレンディセミナー フレームワークとしてのTrac技術トレンディセミナー フレームワークとしてのTrac
技術トレンディセミナー フレームワークとしてのTracterada
 
【12-D-2】 WPF アプリケーション開発
【12-D-2】 WPF アプリケーション開発【12-D-2】 WPF アプリケーション開発
【12-D-2】 WPF アプリケーション開発devsumi2009
 
090608-TogoWS REST
090608-TogoWS REST090608-TogoWS REST
090608-TogoWS RESTocha_kaneko
 
PHP Conference 09 Japan Microsoft
PHP Conference 09 Japan MicrosoftPHP Conference 09 Japan Microsoft
PHP Conference 09 Japan Microsoft
hirookun
 
Ohp Seijoen H20 06 Mojiretsu
Ohp Seijoen H20 06 MojiretsuOhp Seijoen H20 06 Mojiretsu
Ohp Seijoen H20 06 Mojiretsusesejun
 
Spring基础教程
Spring基础教程Spring基础教程
Spring基础教程
Shilong Sang
 
spring_jiaocheng
spring_jiaochengspring_jiaocheng
spring_jiaocheng
Shilong Sang
 
Reloaded
ReloadedReloaded
Reloaded
Shunsaku Kudo
 
Cloud era -『クラウド時代』マッシュアップ技術による地方からの世界発信
Cloud era -『クラウド時代』マッシュアップ技術による地方からの世界発信Cloud era -『クラウド時代』マッシュアップ技術による地方からの世界発信
Cloud era -『クラウド時代』マッシュアップ技術による地方からの世界発信
Yusuke Kawasaki
 
【13 C 2】デベロッパーに贈る!M-V-VMパターンで造るWPFアプリケーション
【13 C 2】デベロッパーに贈る!M-V-VMパターンで造るWPFアプリケーション【13 C 2】デベロッパーに贈る!M-V-VMパターンで造るWPFアプリケーション
【13 C 2】デベロッパーに贈る!M-V-VMパターンで造るWPFアプリケーション
Yuya Yamaki
 
Open Source Type Pad Mobile
Open Source Type Pad MobileOpen Source Type Pad Mobile
Open Source Type Pad MobileHiroshi Sakai
 
1242361147my upload ${file.name}
1242361147my upload ${file.name}1242361147my upload ${file.name}
1242361147my upload ${file.name}51 lecture
 
PHP超入門@LL温泉
PHP超入門@LL温泉PHP超入門@LL温泉
PHP超入門@LL温泉
Sotaro Karasawa
 
Sc2009autumn 次世代Daoフレームワーク Doma
Sc2009autumn 次世代Daoフレームワーク DomaSc2009autumn 次世代Daoフレームワーク Doma
Sc2009autumn 次世代Daoフレームワーク DomaToshihiro Nakamura
 
文献紹介:Semantic-based information retrieval in support of concept design.
文献紹介:Semantic-based information retrieval in support of concept design.文献紹介:Semantic-based information retrieval in support of concept design.
文献紹介:Semantic-based information retrieval in support of concept design.
Shin Sano
 
資料庫期末Project Proposal
資料庫期末Project Proposal資料庫期末Project Proposal
資料庫期末Project ProposalFrank Chang
 
dRuby
dRubydRuby
dRuby
toyoshi
 

Similar to WxHaskell (20)

20090418 イケテルRails勉強会 第2部Air編 解説
20090418 イケテルRails勉強会 第2部Air編 解説20090418 イケテルRails勉強会 第2部Air編 解説
20090418 イケテルRails勉強会 第2部Air編 解説
 
技術トレンディセミナー フレームワークとしてのTrac
技術トレンディセミナー フレームワークとしてのTrac技術トレンディセミナー フレームワークとしてのTrac
技術トレンディセミナー フレームワークとしてのTrac
 
【12-D-2】 WPF アプリケーション開発
【12-D-2】 WPF アプリケーション開発【12-D-2】 WPF アプリケーション開発
【12-D-2】 WPF アプリケーション開発
 
090608-TogoWS REST
090608-TogoWS REST090608-TogoWS REST
090608-TogoWS REST
 
PHP Conference 09 Japan Microsoft
PHP Conference 09 Japan MicrosoftPHP Conference 09 Japan Microsoft
PHP Conference 09 Japan Microsoft
 
Ohp Seijoen H20 06 Mojiretsu
Ohp Seijoen H20 06 MojiretsuOhp Seijoen H20 06 Mojiretsu
Ohp Seijoen H20 06 Mojiretsu
 
object-shapes
object-shapesobject-shapes
object-shapes
 
Apache Tapestry
Apache TapestryApache Tapestry
Apache Tapestry
 
Spring基础教程
Spring基础教程Spring基础教程
Spring基础教程
 
spring_jiaocheng
spring_jiaochengspring_jiaocheng
spring_jiaocheng
 
Reloaded
ReloadedReloaded
Reloaded
 
Cloud era -『クラウド時代』マッシュアップ技術による地方からの世界発信
Cloud era -『クラウド時代』マッシュアップ技術による地方からの世界発信Cloud era -『クラウド時代』マッシュアップ技術による地方からの世界発信
Cloud era -『クラウド時代』マッシュアップ技術による地方からの世界発信
 
【13 C 2】デベロッパーに贈る!M-V-VMパターンで造るWPFアプリケーション
【13 C 2】デベロッパーに贈る!M-V-VMパターンで造るWPFアプリケーション【13 C 2】デベロッパーに贈る!M-V-VMパターンで造るWPFアプリケーション
【13 C 2】デベロッパーに贈る!M-V-VMパターンで造るWPFアプリケーション
 
Open Source Type Pad Mobile
Open Source Type Pad MobileOpen Source Type Pad Mobile
Open Source Type Pad Mobile
 
1242361147my upload ${file.name}
1242361147my upload ${file.name}1242361147my upload ${file.name}
1242361147my upload ${file.name}
 
PHP超入門@LL温泉
PHP超入門@LL温泉PHP超入門@LL温泉
PHP超入門@LL温泉
 
Sc2009autumn 次世代Daoフレームワーク Doma
Sc2009autumn 次世代Daoフレームワーク DomaSc2009autumn 次世代Daoフレームワーク Doma
Sc2009autumn 次世代Daoフレームワーク Doma
 
文献紹介:Semantic-based information retrieval in support of concept design.
文献紹介:Semantic-based information retrieval in support of concept design.文献紹介:Semantic-based information retrieval in support of concept design.
文献紹介:Semantic-based information retrieval in support of concept design.
 
資料庫期末Project Proposal
資料庫期末Project Proposal資料庫期末Project Proposal
資料庫期末Project Proposal
 
dRuby
dRubydRuby
dRuby
 

More from ina job

KubeWeekly読書メモの紹介
KubeWeekly読書メモの紹介KubeWeekly読書メモの紹介
KubeWeekly読書メモの紹介
ina job
 
僕の 技術の無駄遣いを 紹介します
僕の 技術の無駄遣いを 紹介します僕の 技術の無駄遣いを 紹介します
僕の 技術の無駄遣いを 紹介します
ina job
 
シェル入門
シェル入門シェル入門
シェル入門
ina job
 
Voice remix!
Voice remix!Voice remix!
Voice remix!
ina job
 
Mustache入門
Mustache入門Mustache入門
Mustache入門
ina job
 
MTM07で電子楽器を展示してきた
MTM07で電子楽器を展示してきたMTM07で電子楽器を展示してきた
MTM07で電子楽器を展示してきた
ina job
 
Erlangやってみた
ErlangやってみたErlangやってみた
Erlangやってみた
ina job
 
SVNのすすめ&Redmineでプロジェクト管理
SVNのすすめ&Redmineでプロジェクト管理SVNのすすめ&Redmineでプロジェクト管理
SVNのすすめ&Redmineでプロジェクト管理
ina job
 
OooBasic
OooBasicOooBasic
OooBasic
ina job
 
ICFP2009-いかにして我々は戦ったか
ICFP2009-いかにして我々は戦ったかICFP2009-いかにして我々は戦ったか
ICFP2009-いかにして我々は戦ったか
ina job
 
context free art
context free artcontext free art
context free art
ina job
 
webを飾る技術
webを飾る技術webを飾る技術
webを飾る技術
ina job
 

More from ina job (12)

KubeWeekly読書メモの紹介
KubeWeekly読書メモの紹介KubeWeekly読書メモの紹介
KubeWeekly読書メモの紹介
 
僕の 技術の無駄遣いを 紹介します
僕の 技術の無駄遣いを 紹介します僕の 技術の無駄遣いを 紹介します
僕の 技術の無駄遣いを 紹介します
 
シェル入門
シェル入門シェル入門
シェル入門
 
Voice remix!
Voice remix!Voice remix!
Voice remix!
 
Mustache入門
Mustache入門Mustache入門
Mustache入門
 
MTM07で電子楽器を展示してきた
MTM07で電子楽器を展示してきたMTM07で電子楽器を展示してきた
MTM07で電子楽器を展示してきた
 
Erlangやってみた
ErlangやってみたErlangやってみた
Erlangやってみた
 
SVNのすすめ&Redmineでプロジェクト管理
SVNのすすめ&Redmineでプロジェクト管理SVNのすすめ&Redmineでプロジェクト管理
SVNのすすめ&Redmineでプロジェクト管理
 
OooBasic
OooBasicOooBasic
OooBasic
 
ICFP2009-いかにして我々は戦ったか
ICFP2009-いかにして我々は戦ったかICFP2009-いかにして我々は戦ったか
ICFP2009-いかにして我々は戦ったか
 
context free art
context free artcontext free art
context free art
 
webを飾る技術
webを飾る技術webを飾る技術
webを飾る技術
 

Recently uploaded

Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
Neo4j
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
RinaMondal9
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
nkrafacyberclub
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
Peter Spielvogel
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems S.M.S.A.
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 

Recently uploaded (20)

Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 

WxHaskell

  • 1. λ WxHaskell λλ inajob http://d.hatena.ne.jp/inajob/
  • 2. λ wxWidgets λλ ● クロスプラットホームなGUIツールキット – 単にGUIのセットだけではなく通信や文字列操作、ファイル 管理も行うことが出来る欲張りなライブラリ – C++で記述されているが様々な言語から利用可能 ● wxPython,wxPerl,WxHaskell... ● 類似品 – Gtk – Tk – Qt – Swing
  • 3. λ Haskell λλ ● 純関数型言語 – 正直なところ何が出来るのかとか僕は理解していない – Haskellを理解するためにGUIアプリケーションを作ってみる ● WxHaskell – HaskellからwxWidgetsを操作するためのラッパライブラリ – これでHaskellを使ってGUIアプリケーションが作れる main = putStrLn “Hello world” main = putStrLn $ show 2008 main = putStrLn (show 2008)
  • 4. λ 日本語 λλ ● ソースコードにutf8を使うと日本語を表示できる – ソースコード中の文字を自動でUCS4に変換する ● 読み込んだデータを表示する – そのままだと文字化けする – hogehoge⇒UCS4 変換を利用する (hogehoge:読み込んだデータの文字コード)
  • 5. λ 初めてのWindow λλ import Graphics.UI.WX main = start mainFrame mainFrame = do f <- frameFixed [text := quot;はろー Worldquot;] p <- panel f [] set f [layout := minsize (sz 300 300) $ widget p] ● いきなりdo – GUIを扱う命令はIOなので仕方がないです ● := でプロパティを設定可能
  • 6. λ 初めてのWindow2 λλ import Graphics.UI.WX main = start mainFrame mainFrame = do s <- readFile “title.txt” f <- frameFixed [text := utf8ToUcs4 s] p <- panel f [] set f [layout := minsize (sz 300 300) $ widget p] ● 外部データをGUIに表示する時は変換関数を通す
  • 7. λ はじめてのレイアウト λλ mainFrame = do f <- frame [text := quot;titlequot;] p <- panel f [] b <- button p [text := quot;pushquot;] i <- textEntry p[text := quot;aquot;] set p [layout := (row 2 [fill$widget i,widget b])] set f [layout := (fill $ widget p)] ● button,textEntry ● widget,row,column,fill,等でレイアウトを整える – リサイズに耐える設計 ● 親をちゃんと指定しましょう
  • 8. λ もっとレイアウト λλ mainFrame = do f <- frame [text := quot;titlequot;] p <- panel f [] b <- button p [text := quot;pushquot;] i <- textEntry p[text := quot;aquot;] l <- singleListBox p [items := [quot;inaquot;,quot;jobquot;,quot;kpcquot;]]; set p [layout :=(column 2 [ (row 2 [fill$widget i,widget b]), fill$widget l ])] set f [layout := (fill $ widget p)] ● singleListBox
  • 9. λ イベント λλ mainFrame = do f <- frame [text := quot;titlequot;] p <- panel f [] b <- button p [text := quot;pushquot;,on command ::= buttonEv] i <- textEntry p [text := quot;aquot;] set p [layout := (row 2 [fill$widget i,widget b])] set f [layout := (fill $ widget p)] buttonEv w = showDialog quot;helloquot; quot;worldquot; w showDialog:: String -> String -> Window a -> IO () showDialog msg title parent = do mesd <- messageDialogCreate parent msg title wxOK messageDialogShowModal mesd messageDialogDelete mesd ● クリックされると関数が呼び出される
  • 10. λ マルチスレッドとチャンネル λλ mainFrame = do eventsChan <- newChan --MultiThread Queue f <- frame [text := quot;titlequot;] p <- panel f [] i <- textEntry p [text := quot;aquot;] b <- button p [text:=quot;pushquot;,on command::=buttonEv i eventsChan] set p [layout := (row 2 [fill$widget i,widget b])] set f [layout := (fill $ widget p)] timer <- windowTimerCreate f timerOnCommand timer (onTimer eventsChan i) timerStart timer 500 False onTimer chan i = do noEvents <- isEmptyChan chan if noEvents then return () else do str <- readChan chan; set i [text := show$str] buttonEv i chan w= do forkOS child set i [text:= quot;startquot;] where child = writeChan chan $fact 1000000 fact n=foldl' (*) 1 [1..n] ● 別スレッドからの信号をタイマーで受け取る – (重い計算をするとどっち道固まったorz)
  • 11. λ Twitterクライアントを書いてみた λλ ● 一応かけた ● 良かったこと – JSONのパーサをいじるのが楽だった – 必要かどうか不明な通信を遅延評価で隠蔽 (unsafePerformIOの利用) ● 悪かったこと – GUI周りはとても手続き的 – 通信も手続き的 – コンパイルである程度バグが取れるが、それ以降のデバッ グがやりにくい ● http://d.hatena.ne.jp/inajob/20081005
  • 12. λ まとめ λλ ● GUIは手続き型言語に任せて ● パーサやアルゴリズムのコアの部分をHaskellで記述 するのがよさそう