SlideShare a Scribd company logo
1 of 93
Download to read offline
FRP
Functional Reactive Programming
Hyunje Jun @ LINE UIT
@noraesae
Self introduction
@noraesae
Self introduction
• 전현제, Hyunje Jun, 全賢濟, ジョン ヒョンジェ
@noraesae
Self introduction
• 전현제, Hyunje Jun, 全賢濟, ジョン ヒョンジェ
• @noraesae on Twitter and GitHub
@noraesae
Self introduction
• 전현제, Hyunje Jun, 全賢濟, ジョン ヒョンジェ
• @noraesae on Twitter and GitHub
• Frontend
@noraesae
Self introduction
• 전현제, Hyunje Jun, 全賢濟, ジョン ヒョンジェ
• @noraesae on Twitter and GitHub
• Frontend
• Programming language
@noraesae
Self introduction
• 전현제, Hyunje Jun, 全賢濟, ジョン ヒョンジェ
• @noraesae on Twitter and GitHub
• Frontend
• Programming language
• FP, mainly Haskell
@noraesae
Agenda
@noraesae
Agenda
• What FRP is
@noraesae
Agenda
• What FRP is
• History of FRP
@noraesae
Agenda
• What FRP is
• History of FRP
• Why FRP matters
@noraesae
What is FRP?
@noraesae
What is NOT FRP?
@noraesae
What FRP isn’t
• Reactive Programming is not FRP
• ReactiveX(RxJS, RxSwift, etc), ReactiveCocoa
ReactiveX may be functional, and it may be reactive, but
“functional reactive programming” is a different animal.
On ReactiveX - Intro
@noraesae
What FRP isn’t
• Neither of this kind of graphs
Staltz, A. (2014). “The introduction to Reactive Programming you’ve been missing.”
• Stream, Observable, etc...
@noraesae
Again, what is FRP?
@noraesae
Declarativity
@noraesae
FRP is about being, not doing!
Elliott, C. (2015). “The Essence and Origins of Functional Reactive Programming.”
In Lambda Jam ’15.
@noraesae
FRP: declarativity
• How things are being at a moment
@noraesae
FRP: declarativity
• How things are being at a moment
• Elegantly
@noraesae
FRP: declarativity
• How things are being at a moment
• Elegantly
• Lazily
@noraesae
“Functional Reactive Animation.”
Elliott, C, Hudak, P. (1997). In ICFP ’97.
@noraesae
“Functional Reactive Animation.”
Elliott, C, Hudak, P. (1997). In ICFP ’97.
• Behaviour a
@noraesae
“Functional Reactive Animation.”
Elliott, C, Hudak, P. (1997). In ICFP ’97.
• Behaviour a
• Time-varying data
@noraesae
“Functional Reactive Animation.”
Elliott, C, Hudak, P. (1997). In ICFP ’97.
• Behaviour a
• Time-varying data
@noraesae
“Functional Reactive Animation.”
Elliott, C, Hudak, P. (1997). In ICFP ’97.
• Behaviour a
• Time-varying data
• red :: Behaviour Color
@noraesae
“Functional Reactive Animation.”
Elliott, C, Hudak, P. (1997). In ICFP ’97.
• Behaviour a
• Time-varying data
• red :: Behaviour Color
• view :: Behaviour Html
@noraesae
“Functional Reactive Animation.”
Elliott, C, Hudak, P. (1997). In ICFP ’97.
• Event a
@noraesae
“Functional Reactive Animation.”
Elliott, C, Hudak, P. (1997). In ICFP ’97.
• Event a
• Time-specific data
@noraesae
“Functional Reactive Animation.”
Elliott, C, Hudak, P. (1997). In ICFP ’97.
• Event a
• Time-specific data
@noraesae
“Functional Reactive Animation.”
Elliott, C, Hudak, P. (1997). In ICFP ’97.
• Event a
• Time-specific data
• everySecond :: Event Int
@noraesae
“Functional Reactive Animation.”
Elliott, C, Hudak, P. (1997). In ICFP ’97.
• Event a
• Time-specific data
• everySecond :: Event Int
• click :: Event Mouse
@noraesae
“Functional Reactive Animation.”
Elliott, C, Hudak, P. (1997). In ICFP ’97.
• Utility functions
• until :: Behaviour a ->
Event (Behaviour a) ->
Behaviour a
• andThen :: Event x ->
Behaviour a ->
Event (Behaviour a)
@noraesae
“Functional Reactive Animation.”
Elliott, C, Hudak, P. (1997). In ICFP ’97.
• Utility functions
• until :: Behaviour a ->
Event (Behaviour a) ->
Behaviour a
• andThen :: Event x ->
Behaviour a ->
Event (Behaviour a)
@noraesae
“Functional Reactive Animation.”
Elliott, C, Hudak, P. (1997). In ICFP ’97.
colorCycle =
red ‘until‘ click ‘andThen‘
blue ‘until‘ click ‘andThen‘
green ‘until‘ click ‘andThen‘
red
@noraesae
Looks good!
@noraesae
Looks good!
• It’s an intuitive and elegant way to describe GUI
@noraesae
Looks good!
• It’s an intuitive and elegant way to describe GUI
• It’s also a continuous and lazy way
• red ‘until‘ click
@noraesae
Surprisingly, I have a demo!
https://github.com/noraesae/purescript-behaviors
@noraesae
Further studies on FRP
• Real-time FRP
• Arrowized FRP
• Event-driven FRP
@noraesae
Real-time FRP
Wan, Z, Taha, W, Hudak, P. (2001). “Real-time frp.” In ICFP ’01.
@noraesae
Real-time FRP
Wan, Z, Taha, W, Hudak, P. (2001). “Real-time frp.” In ICFP ’01.
• They found interesting fact
@noraesae
Real-time FRP
Wan, Z, Taha, W, Hudak, P. (2001). “Real-time frp.” In ICFP ’01.
• They found interesting fact
@noraesae
Real-time FRP
Wan, Z, Taha, W, Hudak, P. (2001). “Real-time frp.” In ICFP ’01.
• They found interesting fact
• Event a = Behaviour (Maybe a)
@noraesae
Real-time FRP
Wan, Z, Taha, W, Hudak, P. (2001). “Real-time frp.” In ICFP ’01.
• They found interesting fact
• Event a = Behaviour (Maybe a)
• Now Behaviour and Event are the same!
@noraesae
Real-time FRP
Wan, Z, Taha, W, Hudak, P. (2001). “Real-time frp.” In ICFP ’01.
• They found interesting fact
• Event a = Behaviour (Maybe a)
• Now Behaviour and Event are the same!
• Rename Behaviour to Signal
@noraesae
Real-time FRP
Wan, Z, Taha, W, Hudak, P. (2001). “Real-time frp.” In ICFP ’01.
• Simplify the semantic
@noraesae
Real-time FRP
Wan, Z, Taha, W, Hudak, P. (2001). “Real-time frp.” In ICFP ’01.
• Simplify the semantic
• Focus on manageability
@noraesae
Arrowized FRP
Nilson, H, Courtney, A, Peterson, J. (2002).
“Functional reactive programming, continued.” In Haskell ’02.
@noraesae
Arrowized FRP
Nilson, H, Courtney, A, Peterson, J. (2002).
“Functional reactive programming, continued.” In Haskell ’02.
• Define Signal Function: SF a b
• a function accepting a signal, and returning a signal
• SF a b = Signal a -> Signal b
@noraesae
Arrowized FRP
Nilson, H, Courtney, A, Peterson, J. (2002).
“Functional reactive programming, continued.” In Haskell ’02.
• Expose signal functions, but not the signal itself
• render :: SF State View
@noraesae
Arrowized FRP
Nilson, H, Courtney, A, Peterson, J. (2002).
“Functional reactive programming, continued.” In Haskell ’02.
• Expose signal functions, but not the signal itself
• render :: SF State View
• Hide internals of Signal
@noraesae
Arrowized FRP
Nilson, H, Courtney, A, Peterson, J. (2002).
“Functional reactive programming, continued.” In Haskell ’02.
• Expose signal functions, but not the signal itself
• render :: SF State View
• Hide internals of Signal
• Focus on data manipulation itself
@noraesae
Event-driven FRP
Wan, Z, Taha, W, Hudak, P. (2002). “Event-driven frp.‘’ In PADL ’02.
@noraesae
Event-driven FRP
Wan, Z, Taha, W, Hudak, P. (2002). “Event-driven frp.‘’ In PADL ’02.
• Assume Signal is discrete
@noraesae
Event-driven FRP
Wan, Z, Taha, W, Hudak, P. (2002). “Event-driven frp.‘’ In PADL ’02.
• Assume Signal is discrete
• Signal changes only when an event occurs
@noraesae
Event-driven FRP
Wan, Z, Taha, W, Hudak, P. (2002). “Event-driven frp.‘’ In PADL ’02.
• Assume Signal is discrete
• Signal changes only when an event occurs
• Prevent unnecessary behaviour updates
@noraesae
Case Study: Elm
@noraesae
Elm
Czaplicki, E. (2012). “Elm: Concurrent FRP for Functional GUIs.”
• “A delightful language for reliable webapps”
@noraesae
Elm
Czaplicki, E. (2012). “Elm: Concurrent FRP for Functional GUIs.”
• “A delightful language for reliable webapps”
• Elm = Event-driven FRP + Arrowized FRP + Concurrent FRP
@noraesae
Elm
Czaplicki, E. (2012). “Elm: Concurrent FRP for Functional GUIs.”
• “A delightful language for reliable webapps”
• Elm = Event-driven FRP + Arrowized FRP + Concurrent FRP
• Discrete signal
@noraesae
Elm
Czaplicki, E. (2012). “Elm: Concurrent FRP for Functional GUIs.”
• “A delightful language for reliable webapps”
• Elm = Event-driven FRP + Arrowized FRP + Concurrent FRP
• Discrete signal
• Signal functions
@noraesae
Elm
Czaplicki, E. (2012). “Elm: Concurrent FRP for Functional GUIs.”
• “A delightful language for reliable webapps”
• Elm = Event-driven FRP + Arrowized FRP + Concurrent FRP
• Discrete signal
• Signal functions
• Global event dispatcher
@noraesae
Elm
Czaplicki, E. (2012). “Elm: Concurrent FRP for Functional GUIs.”
update : Event -> Color -> Color
update event color =
case event of
ColorCycle ->
case color of
Red -> Blue
Blue -> Green
Green -> Red
@noraesae
Elm
Czaplicki, E. (2012). “Elm: Concurrent FRP for Functional GUIs.”
view : Color -> Html Event
view color =
div [ onClick ColorCycle
, style [("background-color", color)]
]
[ ]
@noraesae
It doesn’t look so elegant!
@noraesae
It doesn’t look so elegant!
• Classical FRP
red ‘until‘ click
@noraesae
It doesn’t look so elegant!
• Classical FRP
red ‘until‘ click
• Elm
update event color = case event of ...
view color = ...
@noraesae
It doesn’t look so elegant!
• Classical FRP
red ‘until‘ click
• Elm
update event color = case event of ...
view color = ...
• Elm is not classical FRP
@noraesae
Why not classical FRP?
@noraesae
Why not classical FRP?
• Web is discrete
• Classical FRP is based on continuity and laziness
@noraesae
Why not classical FRP?
• Web is discrete
• Classical FRP is based on continuity and laziness
• Hard to implement laziness on discrete env
• Timer, Polling, etc...
@noraesae
Why not classical FRP?
• Web is discrete
• Classical FRP is based on continuity and laziness
• Hard to implement laziness on discrete env
• Timer, Polling, etc...
• “I might argue that Elm was never about FRP”
Czaplicki, E. (2016). “A Farewell to FRP.” On Elm-lang Blog.
@noraesae
However, FRP still matters.
@noraesae
Maintainability & Testability
@noraesae
Why FRP matters: Maintainability
@noraesae
Why FRP matters: Maintainability
• Web app can be represented as function
• SF State View
@noraesae
Why FRP matters: Maintainability
• Web app can be represented as function
• SF State View
• State is SSOT(single source of truth)
@noraesae
Why FRP matters: Maintainability
• Web app can be represented as function
• SF State View
• State is SSOT(single source of truth)
• Bonus: Time-travel debugging is just a function call
@noraesae
Why FRP matters: Maintainability
• Web app can be represented as function
• SF State View
• State is SSOT(single source of truth)
• Bonus: Time-travel debugging is just a function call
• Signal a = Time -> a
@noraesae
Why FRP matters: Maintainability
• Web app can be represented as function
• SF State View
• State is SSOT(single source of truth)
• Bonus: Time-travel debugging is just a function call
• Signal a = Time -> a
• Signal View = Time -> View
@noraesae
Why FRP matters: Testability
@noraesae
Why FRP matters: Testability
• Signal isomorphism
@noraesae
Why FRP matters: Testability
• Signal isomorphism
• Signal a = SF RealWorld a
@noraesae
Why FRP matters: Testability
• Signal isomorphism
• Signal a = SF RealWorld a
• Replace RealWorld with TestWorld for tests
@noraesae
Why FRP matters: Testability
• Signal isomorphism
• Signal a = SF RealWorld a
• Replace RealWorld with TestWorld for tests
• Replace RealWorld with ServerWorld for free SSR(!)
@noraesae
Conclusion
@noraesae
Conclusion
• What FRP is
• Represent how a thing is being, in elegant and lazy way
@noraesae
Conclusion
• What FRP is
• Represent how a thing is being, in elegant and lazy way
• History of FRP
• FRP has firm backgrounds
@noraesae
Conclusion
• What FRP is
• Represent how a thing is being, in elegant and lazy way
• History of FRP
• FRP has firm backgrounds
• Why FRP matters
• Maintainability
• Testability
@noraesae
References I
Conal Elliott and Paul Hudak. “Functional Reactive Animation”. In:
ICFP ’97 (1997).
Evan Czaplicki. “Elm: Concurrent FRP for Functional GUIs”. In:
(2012).
Conal Elliott. “The Essence and Origins of Functional Reactive
Programming”. In: Lambda Jam. 2015.
Evan Czaplicki. A Farewell to FRP. 2016. url:
http://elm-lang.org/blog/farewell-to-frp.
@noraesae
References II
Redux - Read Me. url: http://redux.js.org.
ReactiveX - Intro. url: http://reactivex.io/intro.html.
@noraesae
FRP
Functional Reactive Programming
Hyunje Jun @ LINE UIT
@noraesae

More Related Content

More from LINE Corporation

UI Automation Test with JUnit5
UI Automation Test with JUnit5UI Automation Test with JUnit5
UI Automation Test with JUnit5LINE Corporation
 
Feature Detection for UI Testing
Feature Detection for UI TestingFeature Detection for UI Testing
Feature Detection for UI TestingLINE Corporation
 
LINE 新星計劃介紹與新創團隊分享
LINE 新星計劃介紹與新創團隊分享LINE 新星計劃介紹與新創團隊分享
LINE 新星計劃介紹與新創團隊分享LINE Corporation
 
​LINE 技術合作夥伴與應用分享
​LINE 技術合作夥伴與應用分享​LINE 技術合作夥伴與應用分享
​LINE 技術合作夥伴與應用分享LINE Corporation
 
LINE 開發者社群經營與技術推廣
LINE 開發者社群經營與技術推廣LINE 開發者社群經營與技術推廣
LINE 開發者社群經營與技術推廣LINE Corporation
 
日本開發者大會短講分享
日本開發者大會短講分享日本開發者大會短講分享
日本開發者大會短講分享LINE Corporation
 
LINE Chatbot - 活動報名報到設計分享
LINE Chatbot - 活動報名報到設計分享LINE Chatbot - 活動報名報到設計分享
LINE Chatbot - 活動報名報到設計分享LINE Corporation
 
在 LINE 私有雲中使用 Managed Kubernetes
在 LINE 私有雲中使用 Managed Kubernetes在 LINE 私有雲中使用 Managed Kubernetes
在 LINE 私有雲中使用 Managed KubernetesLINE Corporation
 
LINE TODAY高效率的敏捷測試開發技巧
LINE TODAY高效率的敏捷測試開發技巧LINE TODAY高效率的敏捷測試開發技巧
LINE TODAY高效率的敏捷測試開發技巧LINE Corporation
 
LINE 區塊鏈平台及代幣經濟 - LINK Chain及LINK介紹
LINE 區塊鏈平台及代幣經濟 - LINK Chain及LINK介紹LINE 區塊鏈平台及代幣經濟 - LINK Chain及LINK介紹
LINE 區塊鏈平台及代幣經濟 - LINK Chain及LINK介紹LINE Corporation
 
LINE Things - LINE IoT平台新技術分享
LINE Things - LINE IoT平台新技術分享LINE Things - LINE IoT平台新技術分享
LINE Things - LINE IoT平台新技術分享LINE Corporation
 
LINE Pay - 一卡通支付新體驗
LINE Pay - 一卡通支付新體驗LINE Pay - 一卡通支付新體驗
LINE Pay - 一卡通支付新體驗LINE Corporation
 
LINE Platform API Update - 打造一個更好的Chatbot服務
LINE Platform API Update - 打造一個更好的Chatbot服務LINE Platform API Update - 打造一個更好的Chatbot服務
LINE Platform API Update - 打造一個更好的Chatbot服務LINE Corporation
 
Keynote - ​LINE 的技術策略佈局與跨國產品開發
Keynote - ​LINE 的技術策略佈局與跨國產品開發Keynote - ​LINE 的技術策略佈局與跨國產品開發
Keynote - ​LINE 的技術策略佈局與跨國產品開發LINE Corporation
 
LINE Ads Platformの開発を支えるKafka
LINE Ads Platformの開発を支えるKafkaLINE Ads Platformの開発を支えるKafka
LINE Ads Platformの開発を支えるKafkaLINE Corporation
 
I/O intensiveなKafka ConsumerアプリケーションのスループットをLINE Ads Platformではどのように改善したか
I/O intensiveなKafka ConsumerアプリケーションのスループットをLINE Ads Platformではどのように改善したかI/O intensiveなKafka ConsumerアプリケーションのスループットをLINE Ads Platformではどのように改善したか
I/O intensiveなKafka ConsumerアプリケーションのスループットをLINE Ads Platformではどのように改善したかLINE Corporation
 
生粋のKotlin LoverによるLINEのKotlinの話
生粋のKotlin LoverによるLINEのKotlinの話生粋のKotlin LoverによるLINEのKotlinの話
生粋のKotlin LoverによるLINEのKotlinの話LINE Corporation
 
LINEで広告プラットフォームをJava+Golangで立ち上げた話
LINEで広告プラットフォームをJava+Golangで立ち上げた話LINEで広告プラットフォームをJava+Golangで立ち上げた話
LINEで広告プラットフォームをJava+Golangで立ち上げた話LINE Corporation
 
Efficient And Invincible Big Data Platform
Efficient And Invincible Big Data PlatformEfficient And Invincible Big Data Platform
Efficient And Invincible Big Data PlatformLINE Corporation
 

More from LINE Corporation (20)

GA Test Automation
GA Test AutomationGA Test Automation
GA Test Automation
 
UI Automation Test with JUnit5
UI Automation Test with JUnit5UI Automation Test with JUnit5
UI Automation Test with JUnit5
 
Feature Detection for UI Testing
Feature Detection for UI TestingFeature Detection for UI Testing
Feature Detection for UI Testing
 
LINE 新星計劃介紹與新創團隊分享
LINE 新星計劃介紹與新創團隊分享LINE 新星計劃介紹與新創團隊分享
LINE 新星計劃介紹與新創團隊分享
 
​LINE 技術合作夥伴與應用分享
​LINE 技術合作夥伴與應用分享​LINE 技術合作夥伴與應用分享
​LINE 技術合作夥伴與應用分享
 
LINE 開發者社群經營與技術推廣
LINE 開發者社群經營與技術推廣LINE 開發者社群經營與技術推廣
LINE 開發者社群經營與技術推廣
 
日本開發者大會短講分享
日本開發者大會短講分享日本開發者大會短講分享
日本開發者大會短講分享
 
LINE Chatbot - 活動報名報到設計分享
LINE Chatbot - 活動報名報到設計分享LINE Chatbot - 活動報名報到設計分享
LINE Chatbot - 活動報名報到設計分享
 
在 LINE 私有雲中使用 Managed Kubernetes
在 LINE 私有雲中使用 Managed Kubernetes在 LINE 私有雲中使用 Managed Kubernetes
在 LINE 私有雲中使用 Managed Kubernetes
 
LINE TODAY高效率的敏捷測試開發技巧
LINE TODAY高效率的敏捷測試開發技巧LINE TODAY高效率的敏捷測試開發技巧
LINE TODAY高效率的敏捷測試開發技巧
 
LINE 區塊鏈平台及代幣經濟 - LINK Chain及LINK介紹
LINE 區塊鏈平台及代幣經濟 - LINK Chain及LINK介紹LINE 區塊鏈平台及代幣經濟 - LINK Chain及LINK介紹
LINE 區塊鏈平台及代幣經濟 - LINK Chain及LINK介紹
 
LINE Things - LINE IoT平台新技術分享
LINE Things - LINE IoT平台新技術分享LINE Things - LINE IoT平台新技術分享
LINE Things - LINE IoT平台新技術分享
 
LINE Pay - 一卡通支付新體驗
LINE Pay - 一卡通支付新體驗LINE Pay - 一卡通支付新體驗
LINE Pay - 一卡通支付新體驗
 
LINE Platform API Update - 打造一個更好的Chatbot服務
LINE Platform API Update - 打造一個更好的Chatbot服務LINE Platform API Update - 打造一個更好的Chatbot服務
LINE Platform API Update - 打造一個更好的Chatbot服務
 
Keynote - ​LINE 的技術策略佈局與跨國產品開發
Keynote - ​LINE 的技術策略佈局與跨國產品開發Keynote - ​LINE 的技術策略佈局與跨國產品開發
Keynote - ​LINE 的技術策略佈局與跨國產品開發
 
LINE Ads Platformの開発を支えるKafka
LINE Ads Platformの開発を支えるKafkaLINE Ads Platformの開発を支えるKafka
LINE Ads Platformの開発を支えるKafka
 
I/O intensiveなKafka ConsumerアプリケーションのスループットをLINE Ads Platformではどのように改善したか
I/O intensiveなKafka ConsumerアプリケーションのスループットをLINE Ads Platformではどのように改善したかI/O intensiveなKafka ConsumerアプリケーションのスループットをLINE Ads Platformではどのように改善したか
I/O intensiveなKafka ConsumerアプリケーションのスループットをLINE Ads Platformではどのように改善したか
 
生粋のKotlin LoverによるLINEのKotlinの話
生粋のKotlin LoverによるLINEのKotlinの話生粋のKotlin LoverによるLINEのKotlinの話
生粋のKotlin LoverによるLINEのKotlinの話
 
LINEで広告プラットフォームをJava+Golangで立ち上げた話
LINEで広告プラットフォームをJava+Golangで立ち上げた話LINEで広告プラットフォームをJava+Golangで立ち上げた話
LINEで広告プラットフォームをJava+Golangで立ち上げた話
 
Efficient And Invincible Big Data Platform
Efficient And Invincible Big Data PlatformEfficient And Invincible Big Data Platform
Efficient And Invincible Big Data Platform
 

Recently uploaded

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXssuser89054b
 
Introduction to Artificial Intelligence ( AI)
Introduction to Artificial Intelligence ( AI)Introduction to Artificial Intelligence ( AI)
Introduction to Artificial Intelligence ( AI)ChandrakantDivate1
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxSCMS School of Architecture
 
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARHAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARKOUSTAV SARKAR
 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdfKamal Acharya
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.Kamal Acharya
 
Memory Interfacing of 8086 with DMA 8257
Memory Interfacing of 8086 with DMA 8257Memory Interfacing of 8086 with DMA 8257
Memory Interfacing of 8086 with DMA 8257subhasishdas79
 
Linux Systems Programming: Inter Process Communication (IPC) using Pipes
Linux Systems Programming: Inter Process Communication (IPC) using PipesLinux Systems Programming: Inter Process Communication (IPC) using Pipes
Linux Systems Programming: Inter Process Communication (IPC) using PipesRashidFaridChishti
 
Introduction to Data Visualization,Matplotlib.pdf
Introduction to Data Visualization,Matplotlib.pdfIntroduction to Data Visualization,Matplotlib.pdf
Introduction to Data Visualization,Matplotlib.pdfsumitt6_25730773
 
8th International Conference on Soft Computing, Mathematics and Control (SMC ...
8th International Conference on Soft Computing, Mathematics and Control (SMC ...8th International Conference on Soft Computing, Mathematics and Control (SMC ...
8th International Conference on Soft Computing, Mathematics and Control (SMC ...josephjonse
 
Online electricity billing project report..pdf
Online electricity billing project report..pdfOnline electricity billing project report..pdf
Online electricity billing project report..pdfKamal Acharya
 
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...HenryBriggs2
 
Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...
Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...
Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...ssuserdfc773
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdfKamal Acharya
 
Online food ordering system project report.pdf
Online food ordering system project report.pdfOnline food ordering system project report.pdf
Online food ordering system project report.pdfKamal Acharya
 
8086 Microprocessor Architecture: 16-bit microprocessor
8086 Microprocessor Architecture: 16-bit microprocessor8086 Microprocessor Architecture: 16-bit microprocessor
8086 Microprocessor Architecture: 16-bit microprocessorAshwiniTodkar4
 
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...drmkjayanthikannan
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaOmar Fathy
 

Recently uploaded (20)

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
Introduction to Artificial Intelligence ( AI)
Introduction to Artificial Intelligence ( AI)Introduction to Artificial Intelligence ( AI)
Introduction to Artificial Intelligence ( AI)
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
 
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARHAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdf
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 
Memory Interfacing of 8086 with DMA 8257
Memory Interfacing of 8086 with DMA 8257Memory Interfacing of 8086 with DMA 8257
Memory Interfacing of 8086 with DMA 8257
 
Linux Systems Programming: Inter Process Communication (IPC) using Pipes
Linux Systems Programming: Inter Process Communication (IPC) using PipesLinux Systems Programming: Inter Process Communication (IPC) using Pipes
Linux Systems Programming: Inter Process Communication (IPC) using Pipes
 
Signal Processing and Linear System Analysis
Signal Processing and Linear System AnalysisSignal Processing and Linear System Analysis
Signal Processing and Linear System Analysis
 
Introduction to Data Visualization,Matplotlib.pdf
Introduction to Data Visualization,Matplotlib.pdfIntroduction to Data Visualization,Matplotlib.pdf
Introduction to Data Visualization,Matplotlib.pdf
 
8th International Conference on Soft Computing, Mathematics and Control (SMC ...
8th International Conference on Soft Computing, Mathematics and Control (SMC ...8th International Conference on Soft Computing, Mathematics and Control (SMC ...
8th International Conference on Soft Computing, Mathematics and Control (SMC ...
 
Online electricity billing project report..pdf
Online electricity billing project report..pdfOnline electricity billing project report..pdf
Online electricity billing project report..pdf
 
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
 
Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...
Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...
Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdf
 
Online food ordering system project report.pdf
Online food ordering system project report.pdfOnline food ordering system project report.pdf
Online food ordering system project report.pdf
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
8086 Microprocessor Architecture: 16-bit microprocessor
8086 Microprocessor Architecture: 16-bit microprocessor8086 Microprocessor Architecture: 16-bit microprocessor
8086 Microprocessor Architecture: 16-bit microprocessor
 
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS Lambda
 

Frp

  • 3. Self introduction • 전현제, Hyunje Jun, 全賢濟, ジョン ヒョンジェ @noraesae
  • 4. Self introduction • 전현제, Hyunje Jun, 全賢濟, ジョン ヒョンジェ • @noraesae on Twitter and GitHub @noraesae
  • 5. Self introduction • 전현제, Hyunje Jun, 全賢濟, ジョン ヒョンジェ • @noraesae on Twitter and GitHub • Frontend @noraesae
  • 6. Self introduction • 전현제, Hyunje Jun, 全賢濟, ジョン ヒョンジェ • @noraesae on Twitter and GitHub • Frontend • Programming language @noraesae
  • 7. Self introduction • 전현제, Hyunje Jun, 全賢濟, ジョン ヒョンジェ • @noraesae on Twitter and GitHub • Frontend • Programming language • FP, mainly Haskell @noraesae
  • 9. Agenda • What FRP is @noraesae
  • 10. Agenda • What FRP is • History of FRP @noraesae
  • 11. Agenda • What FRP is • History of FRP • Why FRP matters @noraesae
  • 13. What is NOT FRP? @noraesae
  • 14. What FRP isn’t • Reactive Programming is not FRP • ReactiveX(RxJS, RxSwift, etc), ReactiveCocoa ReactiveX may be functional, and it may be reactive, but “functional reactive programming” is a different animal. On ReactiveX - Intro @noraesae
  • 15. What FRP isn’t • Neither of this kind of graphs Staltz, A. (2014). “The introduction to Reactive Programming you’ve been missing.” • Stream, Observable, etc... @noraesae
  • 16. Again, what is FRP? @noraesae
  • 18. FRP is about being, not doing! Elliott, C. (2015). “The Essence and Origins of Functional Reactive Programming.” In Lambda Jam ’15. @noraesae
  • 19. FRP: declarativity • How things are being at a moment @noraesae
  • 20. FRP: declarativity • How things are being at a moment • Elegantly @noraesae
  • 21. FRP: declarativity • How things are being at a moment • Elegantly • Lazily @noraesae
  • 22. “Functional Reactive Animation.” Elliott, C, Hudak, P. (1997). In ICFP ’97. @noraesae
  • 23. “Functional Reactive Animation.” Elliott, C, Hudak, P. (1997). In ICFP ’97. • Behaviour a @noraesae
  • 24. “Functional Reactive Animation.” Elliott, C, Hudak, P. (1997). In ICFP ’97. • Behaviour a • Time-varying data @noraesae
  • 25. “Functional Reactive Animation.” Elliott, C, Hudak, P. (1997). In ICFP ’97. • Behaviour a • Time-varying data @noraesae
  • 26. “Functional Reactive Animation.” Elliott, C, Hudak, P. (1997). In ICFP ’97. • Behaviour a • Time-varying data • red :: Behaviour Color @noraesae
  • 27. “Functional Reactive Animation.” Elliott, C, Hudak, P. (1997). In ICFP ’97. • Behaviour a • Time-varying data • red :: Behaviour Color • view :: Behaviour Html @noraesae
  • 28. “Functional Reactive Animation.” Elliott, C, Hudak, P. (1997). In ICFP ’97. • Event a @noraesae
  • 29. “Functional Reactive Animation.” Elliott, C, Hudak, P. (1997). In ICFP ’97. • Event a • Time-specific data @noraesae
  • 30. “Functional Reactive Animation.” Elliott, C, Hudak, P. (1997). In ICFP ’97. • Event a • Time-specific data @noraesae
  • 31. “Functional Reactive Animation.” Elliott, C, Hudak, P. (1997). In ICFP ’97. • Event a • Time-specific data • everySecond :: Event Int @noraesae
  • 32. “Functional Reactive Animation.” Elliott, C, Hudak, P. (1997). In ICFP ’97. • Event a • Time-specific data • everySecond :: Event Int • click :: Event Mouse @noraesae
  • 33. “Functional Reactive Animation.” Elliott, C, Hudak, P. (1997). In ICFP ’97. • Utility functions • until :: Behaviour a -> Event (Behaviour a) -> Behaviour a • andThen :: Event x -> Behaviour a -> Event (Behaviour a) @noraesae
  • 34. “Functional Reactive Animation.” Elliott, C, Hudak, P. (1997). In ICFP ’97. • Utility functions • until :: Behaviour a -> Event (Behaviour a) -> Behaviour a • andThen :: Event x -> Behaviour a -> Event (Behaviour a) @noraesae
  • 35. “Functional Reactive Animation.” Elliott, C, Hudak, P. (1997). In ICFP ’97. colorCycle = red ‘until‘ click ‘andThen‘ blue ‘until‘ click ‘andThen‘ green ‘until‘ click ‘andThen‘ red @noraesae
  • 37. Looks good! • It’s an intuitive and elegant way to describe GUI @noraesae
  • 38. Looks good! • It’s an intuitive and elegant way to describe GUI • It’s also a continuous and lazy way • red ‘until‘ click @noraesae
  • 39. Surprisingly, I have a demo! https://github.com/noraesae/purescript-behaviors @noraesae
  • 40. Further studies on FRP • Real-time FRP • Arrowized FRP • Event-driven FRP @noraesae
  • 41. Real-time FRP Wan, Z, Taha, W, Hudak, P. (2001). “Real-time frp.” In ICFP ’01. @noraesae
  • 42. Real-time FRP Wan, Z, Taha, W, Hudak, P. (2001). “Real-time frp.” In ICFP ’01. • They found interesting fact @noraesae
  • 43. Real-time FRP Wan, Z, Taha, W, Hudak, P. (2001). “Real-time frp.” In ICFP ’01. • They found interesting fact @noraesae
  • 44. Real-time FRP Wan, Z, Taha, W, Hudak, P. (2001). “Real-time frp.” In ICFP ’01. • They found interesting fact • Event a = Behaviour (Maybe a) @noraesae
  • 45. Real-time FRP Wan, Z, Taha, W, Hudak, P. (2001). “Real-time frp.” In ICFP ’01. • They found interesting fact • Event a = Behaviour (Maybe a) • Now Behaviour and Event are the same! @noraesae
  • 46. Real-time FRP Wan, Z, Taha, W, Hudak, P. (2001). “Real-time frp.” In ICFP ’01. • They found interesting fact • Event a = Behaviour (Maybe a) • Now Behaviour and Event are the same! • Rename Behaviour to Signal @noraesae
  • 47. Real-time FRP Wan, Z, Taha, W, Hudak, P. (2001). “Real-time frp.” In ICFP ’01. • Simplify the semantic @noraesae
  • 48. Real-time FRP Wan, Z, Taha, W, Hudak, P. (2001). “Real-time frp.” In ICFP ’01. • Simplify the semantic • Focus on manageability @noraesae
  • 49. Arrowized FRP Nilson, H, Courtney, A, Peterson, J. (2002). “Functional reactive programming, continued.” In Haskell ’02. @noraesae
  • 50. Arrowized FRP Nilson, H, Courtney, A, Peterson, J. (2002). “Functional reactive programming, continued.” In Haskell ’02. • Define Signal Function: SF a b • a function accepting a signal, and returning a signal • SF a b = Signal a -> Signal b @noraesae
  • 51. Arrowized FRP Nilson, H, Courtney, A, Peterson, J. (2002). “Functional reactive programming, continued.” In Haskell ’02. • Expose signal functions, but not the signal itself • render :: SF State View @noraesae
  • 52. Arrowized FRP Nilson, H, Courtney, A, Peterson, J. (2002). “Functional reactive programming, continued.” In Haskell ’02. • Expose signal functions, but not the signal itself • render :: SF State View • Hide internals of Signal @noraesae
  • 53. Arrowized FRP Nilson, H, Courtney, A, Peterson, J. (2002). “Functional reactive programming, continued.” In Haskell ’02. • Expose signal functions, but not the signal itself • render :: SF State View • Hide internals of Signal • Focus on data manipulation itself @noraesae
  • 54. Event-driven FRP Wan, Z, Taha, W, Hudak, P. (2002). “Event-driven frp.‘’ In PADL ’02. @noraesae
  • 55. Event-driven FRP Wan, Z, Taha, W, Hudak, P. (2002). “Event-driven frp.‘’ In PADL ’02. • Assume Signal is discrete @noraesae
  • 56. Event-driven FRP Wan, Z, Taha, W, Hudak, P. (2002). “Event-driven frp.‘’ In PADL ’02. • Assume Signal is discrete • Signal changes only when an event occurs @noraesae
  • 57. Event-driven FRP Wan, Z, Taha, W, Hudak, P. (2002). “Event-driven frp.‘’ In PADL ’02. • Assume Signal is discrete • Signal changes only when an event occurs • Prevent unnecessary behaviour updates @noraesae
  • 59. Elm Czaplicki, E. (2012). “Elm: Concurrent FRP for Functional GUIs.” • “A delightful language for reliable webapps” @noraesae
  • 60. Elm Czaplicki, E. (2012). “Elm: Concurrent FRP for Functional GUIs.” • “A delightful language for reliable webapps” • Elm = Event-driven FRP + Arrowized FRP + Concurrent FRP @noraesae
  • 61. Elm Czaplicki, E. (2012). “Elm: Concurrent FRP for Functional GUIs.” • “A delightful language for reliable webapps” • Elm = Event-driven FRP + Arrowized FRP + Concurrent FRP • Discrete signal @noraesae
  • 62. Elm Czaplicki, E. (2012). “Elm: Concurrent FRP for Functional GUIs.” • “A delightful language for reliable webapps” • Elm = Event-driven FRP + Arrowized FRP + Concurrent FRP • Discrete signal • Signal functions @noraesae
  • 63. Elm Czaplicki, E. (2012). “Elm: Concurrent FRP for Functional GUIs.” • “A delightful language for reliable webapps” • Elm = Event-driven FRP + Arrowized FRP + Concurrent FRP • Discrete signal • Signal functions • Global event dispatcher @noraesae
  • 64. Elm Czaplicki, E. (2012). “Elm: Concurrent FRP for Functional GUIs.” update : Event -> Color -> Color update event color = case event of ColorCycle -> case color of Red -> Blue Blue -> Green Green -> Red @noraesae
  • 65. Elm Czaplicki, E. (2012). “Elm: Concurrent FRP for Functional GUIs.” view : Color -> Html Event view color = div [ onClick ColorCycle , style [("background-color", color)] ] [ ] @noraesae
  • 66. It doesn’t look so elegant! @noraesae
  • 67. It doesn’t look so elegant! • Classical FRP red ‘until‘ click @noraesae
  • 68. It doesn’t look so elegant! • Classical FRP red ‘until‘ click • Elm update event color = case event of ... view color = ... @noraesae
  • 69. It doesn’t look so elegant! • Classical FRP red ‘until‘ click • Elm update event color = case event of ... view color = ... • Elm is not classical FRP @noraesae
  • 70. Why not classical FRP? @noraesae
  • 71. Why not classical FRP? • Web is discrete • Classical FRP is based on continuity and laziness @noraesae
  • 72. Why not classical FRP? • Web is discrete • Classical FRP is based on continuity and laziness • Hard to implement laziness on discrete env • Timer, Polling, etc... @noraesae
  • 73. Why not classical FRP? • Web is discrete • Classical FRP is based on continuity and laziness • Hard to implement laziness on discrete env • Timer, Polling, etc... • “I might argue that Elm was never about FRP” Czaplicki, E. (2016). “A Farewell to FRP.” On Elm-lang Blog. @noraesae
  • 74. However, FRP still matters. @noraesae
  • 76. Why FRP matters: Maintainability @noraesae
  • 77. Why FRP matters: Maintainability • Web app can be represented as function • SF State View @noraesae
  • 78. Why FRP matters: Maintainability • Web app can be represented as function • SF State View • State is SSOT(single source of truth) @noraesae
  • 79. Why FRP matters: Maintainability • Web app can be represented as function • SF State View • State is SSOT(single source of truth) • Bonus: Time-travel debugging is just a function call @noraesae
  • 80. Why FRP matters: Maintainability • Web app can be represented as function • SF State View • State is SSOT(single source of truth) • Bonus: Time-travel debugging is just a function call • Signal a = Time -> a @noraesae
  • 81. Why FRP matters: Maintainability • Web app can be represented as function • SF State View • State is SSOT(single source of truth) • Bonus: Time-travel debugging is just a function call • Signal a = Time -> a • Signal View = Time -> View @noraesae
  • 82. Why FRP matters: Testability @noraesae
  • 83. Why FRP matters: Testability • Signal isomorphism @noraesae
  • 84. Why FRP matters: Testability • Signal isomorphism • Signal a = SF RealWorld a @noraesae
  • 85. Why FRP matters: Testability • Signal isomorphism • Signal a = SF RealWorld a • Replace RealWorld with TestWorld for tests @noraesae
  • 86. Why FRP matters: Testability • Signal isomorphism • Signal a = SF RealWorld a • Replace RealWorld with TestWorld for tests • Replace RealWorld with ServerWorld for free SSR(!) @noraesae
  • 88. Conclusion • What FRP is • Represent how a thing is being, in elegant and lazy way @noraesae
  • 89. Conclusion • What FRP is • Represent how a thing is being, in elegant and lazy way • History of FRP • FRP has firm backgrounds @noraesae
  • 90. Conclusion • What FRP is • Represent how a thing is being, in elegant and lazy way • History of FRP • FRP has firm backgrounds • Why FRP matters • Maintainability • Testability @noraesae
  • 91. References I Conal Elliott and Paul Hudak. “Functional Reactive Animation”. In: ICFP ’97 (1997). Evan Czaplicki. “Elm: Concurrent FRP for Functional GUIs”. In: (2012). Conal Elliott. “The Essence and Origins of Functional Reactive Programming”. In: Lambda Jam. 2015. Evan Czaplicki. A Farewell to FRP. 2016. url: http://elm-lang.org/blog/farewell-to-frp. @noraesae
  • 92. References II Redux - Read Me. url: http://redux.js.org. ReactiveX - Intro. url: http://reactivex.io/intro.html. @noraesae
  • 93. FRP Functional Reactive Programming Hyunje Jun @ LINE UIT @noraesae