SlideShare una empresa de Scribd logo
1 de 9
Descargar para leer sin conexión
Safer IoT using functional languageSafer IoT using functional languageSafer IoT using functional languageSafer IoT using functional languageSafer IoT using functional language
Kiwamu Okabe @ RIKEN AICSKiwamu Okabe @ RIKEN AICSKiwamu Okabe @ RIKEN AICSKiwamu Okabe @ RIKEN AICSKiwamu Okabe @ RIKEN AICS
Hardware: ESP8266Hardware: ESP8266Hardware: ESP8266Hardware: ESP8266Hardware: ESP8266
☆ http://espressif.com/en/products/wroom/☆ http://espressif.com/en/products/wroom/☆ http://espressif.com/en/products/wroom/☆ http://espressif.com/en/products/wroom/☆ http://espressif.com/en/products/wroom/
☆ 32-bit low power MCU Wi-Fi Module☆ 32-bit low power MCU Wi-Fi Module☆ 32-bit low power MCU Wi-Fi Module☆ 32-bit low power MCU Wi-Fi Module☆ 32-bit low power MCU Wi-Fi Module
☆ Having integrated TCP/IP network stacks☆ Having integrated TCP/IP network stacks☆ Having integrated TCP/IP network stacks☆ Having integrated TCP/IP network stacks☆ Having integrated TCP/IP network stacks
☆ Including ADC, SDIO, UART, PWM, I2C ...☆ Including ADC, SDIO, UART, PWM, I2C ...☆ Including ADC, SDIO, UART, PWM, I2C ...☆ Including ADC, SDIO, UART, PWM, I2C ...☆ Including ADC, SDIO, UART, PWM, I2C ...
☆ Small form factor of only 18mm x 20mm☆ Small form factor of only 18mm x 20mm☆ Small form factor of only 18mm x 20mm☆ Small form factor of only 18mm x 20mm☆ Small form factor of only 18mm x 20mm
Functional language: ATSFunctional language: ATSFunctional language: ATSFunctional language: ATSFunctional language: ATS
☆ http://www.ats-lang.org/☆ http://www.ats-lang.org/☆ http://www.ats-lang.org/☆ http://www.ats-lang.org/☆ http://www.ats-lang.org/
☆ Syntax like ML☆ Syntax like ML☆ Syntax like ML☆ Syntax like ML☆ Syntax like ML
☆ DML-style dependent types☆ DML-style dependent types☆ DML-style dependent types☆ DML-style dependent types☆ DML-style dependent types
☆ Linear types☆ Linear types☆ Linear types☆ Linear types☆ Linear types
☆ Optional GC☆ Optional GC☆ Optional GC☆ Optional GC☆ Optional GC
☆ Optional malloc/free☆ Optional malloc/free☆ Optional malloc/free☆ Optional malloc/free☆ Optional malloc/free
☆ Optional run-time☆ Optional run-time☆ Optional run-time☆ Optional run-time☆ Optional run-time
DemoDemoDemoDemoDemo
The code is found at following:The code is found at following:The code is found at following:The code is found at following:The code is found at following:
https://github.com/fpiot/esp8266-atshttps://github.com/fpiot/esp8266-atshttps://github.com/fpiot/esp8266-atshttps://github.com/fpiot/esp8266-atshttps://github.com/fpiot/esp8266-ats
Demo environmentDemo environmentDemo environmentDemo environmentDemo environment
Software architectureSoftware architectureSoftware architectureSoftware architectureSoftware architecture
ATS finds forgetting free memoryATS finds forgetting free memoryATS finds forgetting free memoryATS finds forgetting free memoryATS finds forgetting free memory
$�cd�esp8266-ats/ifttt_ats
$�vi�user/user_main.dats
�39�����val�json_open�=�string0_copy�"{"value1":�""
�40�����val�json_close�=�string0_copy�""�}"
�41�����val�temp�=�esp_tostrptr_int�rand
�42�����val�json_head�=�strptr_append�(json_open,�temp)
�43�����val�json_data�=�strptr_append�(json_head,�json_close)
�44�//��val�()�=�(free�json_open;�free�json_close;�free�temp;�free�json_head)
�45�����val�()�=�(free�json_open;�free�json_close;�free�temp)�//�Error!
$�make
ATS�user/user_main.dats
/home/kiwamu/src/esp8266-ats/ifttt_ats/user/user_main.dats:�985(line=32,�
offs=43)�--�2237(line=55,�offs=4):�error(3):�the�linear�dynamic�variable�
[json_head$3823(-1)]�needs�to�be�consumed�but�it�is�preserved�with�the�type�
[S2Eapp(S2Ecst(strptr_addr_vtype);�S2EVar(4441))]�instead.
$�cd�esp8266-ats/ifttt_ats
$�vi�user/user_main.dats
�39�����val�json_open�=�string0_copy�"{"value1":�""
�40�����val�json_close�=�string0_copy�""�}"
�41�����val�temp�=�esp_tostrptr_int�rand
�42�����val�json_head�=�strptr_append�(json_open,�temp)
�43�����val�json_data�=�strptr_append�(json_head,�json_close)
�44�//��val�()�=�(free�json_open;�free�json_close;�free�temp;�free�json_head)
�45�����val�()�=�(free�json_open;�free�json_close;�free�temp)�//�Error!
$�make
ATS�user/user_main.dats
/home/kiwamu/src/esp8266-ats/ifttt_ats/user/user_main.dats:�985(line=32,�
offs=43)�--�2237(line=55,�offs=4):�error(3):�the�linear�dynamic�variable�
[json_head$3823(-1)]�needs�to�be�consumed�but�it�is�preserved�with�the�type�
[S2Eapp(S2Ecst(strptr_addr_vtype);�S2EVar(4441))]�instead.
$�cd�esp8266-ats/ifttt_ats
$�vi�user/user_main.dats
�39�����val�json_open�=�string0_copy�"{"value1":�""
�40�����val�json_close�=�string0_copy�""�}"
�41�����val�temp�=�esp_tostrptr_int�rand
�42�����val�json_head�=�strptr_append�(json_open,�temp)
�43�����val�json_data�=�strptr_append�(json_head,�json_close)
�44�//��val�()�=�(free�json_open;�free�json_close;�free�temp;�free�json_head)
�45�����val�()�=�(free�json_open;�free�json_close;�free�temp)�//�Error!
$�make
ATS�user/user_main.dats
/home/kiwamu/src/esp8266-ats/ifttt_ats/user/user_main.dats:�985(line=32,�
offs=43)�--�2237(line=55,�offs=4):�error(3):�the�linear�dynamic�variable�
[json_head$3823(-1)]�needs�to�be�consumed�but�it�is�preserved�with�the�type�
[S2Eapp(S2Ecst(strptr_addr_vtype);�S2EVar(4441))]�instead.
$�cd�esp8266-ats/ifttt_ats
$�vi�user/user_main.dats
�39�����val�json_open�=�string0_copy�"{"value1":�""
�40�����val�json_close�=�string0_copy�""�}"
�41�����val�temp�=�esp_tostrptr_int�rand
�42�����val�json_head�=�strptr_append�(json_open,�temp)
�43�����val�json_data�=�strptr_append�(json_head,�json_close)
�44�//��val�()�=�(free�json_open;�free�json_close;�free�temp;�free�json_head)
�45�����val�()�=�(free�json_open;�free�json_close;�free�temp)�//�Error!
$�make
ATS�user/user_main.dats
/home/kiwamu/src/esp8266-ats/ifttt_ats/user/user_main.dats:�985(line=32,�
offs=43)�--�2237(line=55,�offs=4):�error(3):�the�linear�dynamic�variable�
[json_head$3823(-1)]�needs�to�be�consumed�but�it�is�preserved�with�the�type�
[S2Eapp(S2Ecst(strptr_addr_vtype);�S2EVar(4441))]�instead.
$�cd�esp8266-ats/ifttt_ats
$�vi�user/user_main.dats
�39�����val�json_open�=�string0_copy�"{"value1":�""
�40�����val�json_close�=�string0_copy�""�}"
�41�����val�temp�=�esp_tostrptr_int�rand
�42�����val�json_head�=�strptr_append�(json_open,�temp)
�43�����val�json_data�=�strptr_append�(json_head,�json_close)
�44�//��val�()�=�(free�json_open;�free�json_close;�free�temp;�free�json_head)
�45�����val�()�=�(free�json_open;�free�json_close;�free�temp)�//�Error!
$�make
ATS�user/user_main.dats
/home/kiwamu/src/esp8266-ats/ifttt_ats/user/user_main.dats:�985(line=32,�
offs=43)�--�2237(line=55,�offs=4):�error(3):�the�linear�dynamic�variable�
[json_head$3823(-1)]�needs�to�be�consumed�but�it�is�preserved�with�the�type�
[S2Eapp(S2Ecst(strptr_addr_vtype);�S2EVar(4441))]�instead.
Functional IoT Meetup at January 30Functional IoT Meetup at January 30Functional IoT Meetup at January 30Functional IoT Meetup at January 30Functional IoT Meetup at January 30
License of photosLicense of photosLicense of photosLicense of photosLicense of photos
*�About�time�I�had�a�whisky�glass!�│�Flickr�-�Photo�Sharing!
��https://www.flickr.com/photos/toolmantim/14834817323/
��Copyright:�Tim�Lucas�/�License:�CC�BY�2.0
*�Japanese�traditional�style�house�design�/�和⾵建築(わふうけんちく)�│�
Flickr�-�Photo�Sharing!
��https://www.flickr.com/photos/tanaka_juuyoh/10720411936/
��Copyright:�TANAKA�Juuyoh�(⽥中⼗洋)�/�License:�CC�BY�2.0
*�Undirected�member-get-member�network�│�Flickr�-�Photo�Sharing!
��https://www.flickr.com/photos/porternovelli/2587018053/
��Copyright:�Porter�Novelli�Global�/�License:�CC�BY-SA�2.0
*�JTAG�board�1�│�Flickr�-�Photo�Sharing!
��https://www.flickr.com/photos/amagill/2877921712/
��Copyright:�Andrew�Magill�/�License:�CC�BY�2.0
*�Creative�Commons�BBB�│�Flickr�-�Photo�Sharing!
��https://www.flickr.com/photos/steren/2732488224/
��Copyright:�Steren�Giannini�/�License:�CC�BY�2.0
*�About�time�I�had�a�whisky�glass!�│�Flickr�-�Photo�Sharing!
��https://www.flickr.com/photos/toolmantim/14834817323/
��Copyright:�Tim�Lucas�/�License:�CC�BY�2.0
*�Japanese�traditional�style�house�design�/�和⾵建築(わふうけんちく)�│�
Flickr�-�Photo�Sharing!
��https://www.flickr.com/photos/tanaka_juuyoh/10720411936/
��Copyright:�TANAKA�Juuyoh�(⽥中⼗洋)�/�License:�CC�BY�2.0
*�Undirected�member-get-member�network�│�Flickr�-�Photo�Sharing!
��https://www.flickr.com/photos/porternovelli/2587018053/
��Copyright:�Porter�Novelli�Global�/�License:�CC�BY-SA�2.0
*�JTAG�board�1�│�Flickr�-�Photo�Sharing!
��https://www.flickr.com/photos/amagill/2877921712/
��Copyright:�Andrew�Magill�/�License:�CC�BY�2.0
*�Creative�Commons�BBB�│�Flickr�-�Photo�Sharing!
��https://www.flickr.com/photos/steren/2732488224/
��Copyright:�Steren�Giannini�/�License:�CC�BY�2.0
*�About�time�I�had�a�whisky�glass!�│�Flickr�-�Photo�Sharing!
��https://www.flickr.com/photos/toolmantim/14834817323/
��Copyright:�Tim�Lucas�/�License:�CC�BY�2.0
*�Japanese�traditional�style�house�design�/�和⾵建築(わふうけんちく)�│�
Flickr�-�Photo�Sharing!
��https://www.flickr.com/photos/tanaka_juuyoh/10720411936/
��Copyright:�TANAKA�Juuyoh�(⽥中⼗洋)�/�License:�CC�BY�2.0
*�Undirected�member-get-member�network�│�Flickr�-�Photo�Sharing!
��https://www.flickr.com/photos/porternovelli/2587018053/
��Copyright:�Porter�Novelli�Global�/�License:�CC�BY-SA�2.0
*�JTAG�board�1�│�Flickr�-�Photo�Sharing!
��https://www.flickr.com/photos/amagill/2877921712/
��Copyright:�Andrew�Magill�/�License:�CC�BY�2.0
*�Creative�Commons�BBB�│�Flickr�-�Photo�Sharing!
��https://www.flickr.com/photos/steren/2732488224/
��Copyright:�Steren�Giannini�/�License:�CC�BY�2.0
*�About�time�I�had�a�whisky�glass!�│�Flickr�-�Photo�Sharing!
��https://www.flickr.com/photos/toolmantim/14834817323/
��Copyright:�Tim�Lucas�/�License:�CC�BY�2.0
*�Japanese�traditional�style�house�design�/�和⾵建築(わふうけんちく)�│�
Flickr�-�Photo�Sharing!
��https://www.flickr.com/photos/tanaka_juuyoh/10720411936/
��Copyright:�TANAKA�Juuyoh�(⽥中⼗洋)�/�License:�CC�BY�2.0
*�Undirected�member-get-member�network�│�Flickr�-�Photo�Sharing!
��https://www.flickr.com/photos/porternovelli/2587018053/
��Copyright:�Porter�Novelli�Global�/�License:�CC�BY-SA�2.0
*�JTAG�board�1�│�Flickr�-�Photo�Sharing!
��https://www.flickr.com/photos/amagill/2877921712/
��Copyright:�Andrew�Magill�/�License:�CC�BY�2.0
*�Creative�Commons�BBB�│�Flickr�-�Photo�Sharing!
��https://www.flickr.com/photos/steren/2732488224/
��Copyright:�Steren�Giannini�/�License:�CC�BY�2.0
*�About�time�I�had�a�whisky�glass!�│�Flickr�-�Photo�Sharing!
��https://www.flickr.com/photos/toolmantim/14834817323/
��Copyright:�Tim�Lucas�/�License:�CC�BY�2.0
*�Japanese�traditional�style�house�design�/�和⾵建築(わふうけんちく)�│�
Flickr�-�Photo�Sharing!
��https://www.flickr.com/photos/tanaka_juuyoh/10720411936/
��Copyright:�TANAKA�Juuyoh�(⽥中⼗洋)�/�License:�CC�BY�2.0
*�Undirected�member-get-member�network�│�Flickr�-�Photo�Sharing!
��https://www.flickr.com/photos/porternovelli/2587018053/
��Copyright:�Porter�Novelli�Global�/�License:�CC�BY-SA�2.0
*�JTAG�board�1�│�Flickr�-�Photo�Sharing!
��https://www.flickr.com/photos/amagill/2877921712/
��Copyright:�Andrew�Magill�/�License:�CC�BY�2.0
*�Creative�Commons�BBB�│�Flickr�-�Photo�Sharing!
��https://www.flickr.com/photos/steren/2732488224/
��Copyright:�Steren�Giannini�/�License:�CC�BY�2.0

Más contenido relacionado

Similar a Safer IoT using functional language

Start! ATS programming
Start! ATS programmingStart! ATS programming
Start! ATS programming
Kiwamu Okabe
 
Emebedded Memories from GF pb-emem presentation
Emebedded Memories from GF pb-emem presentationEmebedded Memories from GF pb-emem presentation
Emebedded Memories from GF pb-emem presentation
sampige
 
Ajhc Haskell Compiler with Reentrant GC
Ajhc Haskell Compiler with Reentrant GCAjhc Haskell Compiler with Reentrant GC
Ajhc Haskell Compiler with Reentrant GC
Kiwamu Okabe
 

Similar a Safer IoT using functional language (20)

ATS programming on ESP8266
ATS programming on ESP8266ATS programming on ESP8266
ATS programming on ESP8266
 
Embedded application designed by ATS language
Embedded application designed by ATS languageEmbedded application designed by ATS language
Embedded application designed by ATS language
 
Functional IoT: Hardware and Platform
Functional IoT: Hardware and PlatformFunctional IoT: Hardware and Platform
Functional IoT: Hardware and Platform
 
Smart.js: JavaScript engine running on tiny MCU
Smart.js: JavaScript engine running on tiny MCUSmart.js: JavaScript engine running on tiny MCU
Smart.js: JavaScript engine running on tiny MCU
 
Emacs verilog-mode is coming to Debian, again
Emacs verilog-mode is coming to Debian, againEmacs verilog-mode is coming to Debian, again
Emacs verilog-mode is coming to Debian, again
 
ATS Programming Tutorial
ATS Programming TutorialATS Programming Tutorial
ATS Programming Tutorial
 
Hands-on VeriFast with STM32 microcontroller @ Osaka
Hands-on VeriFast with STM32 microcontroller @ OsakaHands-on VeriFast with STM32 microcontroller @ Osaka
Hands-on VeriFast with STM32 microcontroller @ Osaka
 
Functional IoT: Introduction
Functional IoT: IntroductionFunctional IoT: Introduction
Functional IoT: Introduction
 
Metasepi team meeting #14: ATS programming on MCU
Metasepi team meeting #14: ATS programming on MCUMetasepi team meeting #14: ATS programming on MCU
Metasepi team meeting #14: ATS programming on MCU
 
Start! ATS programming
Start! ATS programmingStart! ATS programming
Start! ATS programming
 
Functional IoT: Programming Language and OS
Functional IoT: Programming Language and OSFunctional IoT: Programming Language and OS
Functional IoT: Programming Language and OS
 
Hands-on VeriFast with STM32 microcontroller @ Nagoya
Hands-on VeriFast with STM32 microcontroller @ NagoyaHands-on VeriFast with STM32 microcontroller @ Nagoya
Hands-on VeriFast with STM32 microcontroller @ Nagoya
 
Hands-on VeriFast with STM32 microcontroller
Hands-on VeriFast with STM32 microcontrollerHands-on VeriFast with STM32 microcontroller
Hands-on VeriFast with STM32 microcontroller
 
Metasepi team meeting #16: Safety on ATS language + MCU
Metasepi team meeting #16: Safety on ATS language + MCUMetasepi team meeting #16: Safety on ATS language + MCU
Metasepi team meeting #16: Safety on ATS language + MCU
 
Metasepi team meeting #20: Start! ATS programming on MCU
Metasepi team meeting #20: Start! ATS programming on MCUMetasepi team meeting #20: Start! ATS programming on MCU
Metasepi team meeting #20: Start! ATS programming on MCU
 
ATS2 updates 2017
ATS2 updates 2017ATS2 updates 2017
ATS2 updates 2017
 
ARM uVisor Debug Refinement Project(debugging facility improvements)
ARM uVisor Debug Refinement Project(debugging facility improvements)ARM uVisor Debug Refinement Project(debugging facility improvements)
ARM uVisor Debug Refinement Project(debugging facility improvements)
 
Coffeescript: Fad or Useful Tool? Socal Code Camp Fullerton 2015
Coffeescript: Fad or Useful Tool? Socal Code Camp Fullerton 2015Coffeescript: Fad or Useful Tool? Socal Code Camp Fullerton 2015
Coffeescript: Fad or Useful Tool? Socal Code Camp Fullerton 2015
 
Emebedded Memories from GF pb-emem presentation
Emebedded Memories from GF pb-emem presentationEmebedded Memories from GF pb-emem presentation
Emebedded Memories from GF pb-emem presentation
 
Ajhc Haskell Compiler with Reentrant GC
Ajhc Haskell Compiler with Reentrant GCAjhc Haskell Compiler with Reentrant GC
Ajhc Haskell Compiler with Reentrant GC
 

Último

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Último (20)

Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 

Safer IoT using functional language

  • 1. Safer IoT using functional languageSafer IoT using functional languageSafer IoT using functional languageSafer IoT using functional languageSafer IoT using functional language Kiwamu Okabe @ RIKEN AICSKiwamu Okabe @ RIKEN AICSKiwamu Okabe @ RIKEN AICSKiwamu Okabe @ RIKEN AICSKiwamu Okabe @ RIKEN AICS
  • 2. Hardware: ESP8266Hardware: ESP8266Hardware: ESP8266Hardware: ESP8266Hardware: ESP8266 ☆ http://espressif.com/en/products/wroom/☆ http://espressif.com/en/products/wroom/☆ http://espressif.com/en/products/wroom/☆ http://espressif.com/en/products/wroom/☆ http://espressif.com/en/products/wroom/ ☆ 32-bit low power MCU Wi-Fi Module☆ 32-bit low power MCU Wi-Fi Module☆ 32-bit low power MCU Wi-Fi Module☆ 32-bit low power MCU Wi-Fi Module☆ 32-bit low power MCU Wi-Fi Module ☆ Having integrated TCP/IP network stacks☆ Having integrated TCP/IP network stacks☆ Having integrated TCP/IP network stacks☆ Having integrated TCP/IP network stacks☆ Having integrated TCP/IP network stacks ☆ Including ADC, SDIO, UART, PWM, I2C ...☆ Including ADC, SDIO, UART, PWM, I2C ...☆ Including ADC, SDIO, UART, PWM, I2C ...☆ Including ADC, SDIO, UART, PWM, I2C ...☆ Including ADC, SDIO, UART, PWM, I2C ... ☆ Small form factor of only 18mm x 20mm☆ Small form factor of only 18mm x 20mm☆ Small form factor of only 18mm x 20mm☆ Small form factor of only 18mm x 20mm☆ Small form factor of only 18mm x 20mm
  • 3. Functional language: ATSFunctional language: ATSFunctional language: ATSFunctional language: ATSFunctional language: ATS ☆ http://www.ats-lang.org/☆ http://www.ats-lang.org/☆ http://www.ats-lang.org/☆ http://www.ats-lang.org/☆ http://www.ats-lang.org/ ☆ Syntax like ML☆ Syntax like ML☆ Syntax like ML☆ Syntax like ML☆ Syntax like ML ☆ DML-style dependent types☆ DML-style dependent types☆ DML-style dependent types☆ DML-style dependent types☆ DML-style dependent types ☆ Linear types☆ Linear types☆ Linear types☆ Linear types☆ Linear types ☆ Optional GC☆ Optional GC☆ Optional GC☆ Optional GC☆ Optional GC ☆ Optional malloc/free☆ Optional malloc/free☆ Optional malloc/free☆ Optional malloc/free☆ Optional malloc/free ☆ Optional run-time☆ Optional run-time☆ Optional run-time☆ Optional run-time☆ Optional run-time
  • 4. DemoDemoDemoDemoDemo The code is found at following:The code is found at following:The code is found at following:The code is found at following:The code is found at following: https://github.com/fpiot/esp8266-atshttps://github.com/fpiot/esp8266-atshttps://github.com/fpiot/esp8266-atshttps://github.com/fpiot/esp8266-atshttps://github.com/fpiot/esp8266-ats
  • 5. Demo environmentDemo environmentDemo environmentDemo environmentDemo environment
  • 6. Software architectureSoftware architectureSoftware architectureSoftware architectureSoftware architecture
  • 7. ATS finds forgetting free memoryATS finds forgetting free memoryATS finds forgetting free memoryATS finds forgetting free memoryATS finds forgetting free memory $�cd�esp8266-ats/ifttt_ats $�vi�user/user_main.dats �39�����val�json_open�=�string0_copy�"{"value1":�"" �40�����val�json_close�=�string0_copy�""�}" �41�����val�temp�=�esp_tostrptr_int�rand �42�����val�json_head�=�strptr_append�(json_open,�temp) �43�����val�json_data�=�strptr_append�(json_head,�json_close) �44�//��val�()�=�(free�json_open;�free�json_close;�free�temp;�free�json_head) �45�����val�()�=�(free�json_open;�free�json_close;�free�temp)�//�Error! $�make ATS�user/user_main.dats /home/kiwamu/src/esp8266-ats/ifttt_ats/user/user_main.dats:�985(line=32,� offs=43)�--�2237(line=55,�offs=4):�error(3):�the�linear�dynamic�variable� [json_head$3823(-1)]�needs�to�be�consumed�but�it�is�preserved�with�the�type� [S2Eapp(S2Ecst(strptr_addr_vtype);�S2EVar(4441))]�instead. $�cd�esp8266-ats/ifttt_ats $�vi�user/user_main.dats �39�����val�json_open�=�string0_copy�"{"value1":�"" �40�����val�json_close�=�string0_copy�""�}" �41�����val�temp�=�esp_tostrptr_int�rand �42�����val�json_head�=�strptr_append�(json_open,�temp) �43�����val�json_data�=�strptr_append�(json_head,�json_close) �44�//��val�()�=�(free�json_open;�free�json_close;�free�temp;�free�json_head) �45�����val�()�=�(free�json_open;�free�json_close;�free�temp)�//�Error! $�make ATS�user/user_main.dats /home/kiwamu/src/esp8266-ats/ifttt_ats/user/user_main.dats:�985(line=32,� offs=43)�--�2237(line=55,�offs=4):�error(3):�the�linear�dynamic�variable� [json_head$3823(-1)]�needs�to�be�consumed�but�it�is�preserved�with�the�type� [S2Eapp(S2Ecst(strptr_addr_vtype);�S2EVar(4441))]�instead. $�cd�esp8266-ats/ifttt_ats $�vi�user/user_main.dats �39�����val�json_open�=�string0_copy�"{"value1":�"" �40�����val�json_close�=�string0_copy�""�}" �41�����val�temp�=�esp_tostrptr_int�rand �42�����val�json_head�=�strptr_append�(json_open,�temp) �43�����val�json_data�=�strptr_append�(json_head,�json_close) �44�//��val�()�=�(free�json_open;�free�json_close;�free�temp;�free�json_head) �45�����val�()�=�(free�json_open;�free�json_close;�free�temp)�//�Error! $�make ATS�user/user_main.dats /home/kiwamu/src/esp8266-ats/ifttt_ats/user/user_main.dats:�985(line=32,� offs=43)�--�2237(line=55,�offs=4):�error(3):�the�linear�dynamic�variable� [json_head$3823(-1)]�needs�to�be�consumed�but�it�is�preserved�with�the�type� [S2Eapp(S2Ecst(strptr_addr_vtype);�S2EVar(4441))]�instead. $�cd�esp8266-ats/ifttt_ats $�vi�user/user_main.dats �39�����val�json_open�=�string0_copy�"{"value1":�"" �40�����val�json_close�=�string0_copy�""�}" �41�����val�temp�=�esp_tostrptr_int�rand �42�����val�json_head�=�strptr_append�(json_open,�temp) �43�����val�json_data�=�strptr_append�(json_head,�json_close) �44�//��val�()�=�(free�json_open;�free�json_close;�free�temp;�free�json_head) �45�����val�()�=�(free�json_open;�free�json_close;�free�temp)�//�Error! $�make ATS�user/user_main.dats /home/kiwamu/src/esp8266-ats/ifttt_ats/user/user_main.dats:�985(line=32,� offs=43)�--�2237(line=55,�offs=4):�error(3):�the�linear�dynamic�variable� [json_head$3823(-1)]�needs�to�be�consumed�but�it�is�preserved�with�the�type� [S2Eapp(S2Ecst(strptr_addr_vtype);�S2EVar(4441))]�instead. $�cd�esp8266-ats/ifttt_ats $�vi�user/user_main.dats �39�����val�json_open�=�string0_copy�"{"value1":�"" �40�����val�json_close�=�string0_copy�""�}" �41�����val�temp�=�esp_tostrptr_int�rand �42�����val�json_head�=�strptr_append�(json_open,�temp) �43�����val�json_data�=�strptr_append�(json_head,�json_close) �44�//��val�()�=�(free�json_open;�free�json_close;�free�temp;�free�json_head) �45�����val�()�=�(free�json_open;�free�json_close;�free�temp)�//�Error! $�make ATS�user/user_main.dats /home/kiwamu/src/esp8266-ats/ifttt_ats/user/user_main.dats:�985(line=32,� offs=43)�--�2237(line=55,�offs=4):�error(3):�the�linear�dynamic�variable� [json_head$3823(-1)]�needs�to�be�consumed�but�it�is�preserved�with�the�type� [S2Eapp(S2Ecst(strptr_addr_vtype);�S2EVar(4441))]�instead.
  • 8. Functional IoT Meetup at January 30Functional IoT Meetup at January 30Functional IoT Meetup at January 30Functional IoT Meetup at January 30Functional IoT Meetup at January 30
  • 9. License of photosLicense of photosLicense of photosLicense of photosLicense of photos *�About�time�I�had�a�whisky�glass!�│�Flickr�-�Photo�Sharing! ��https://www.flickr.com/photos/toolmantim/14834817323/ ��Copyright:�Tim�Lucas�/�License:�CC�BY�2.0 *�Japanese�traditional�style�house�design�/�和⾵建築(わふうけんちく)�│� Flickr�-�Photo�Sharing! ��https://www.flickr.com/photos/tanaka_juuyoh/10720411936/ ��Copyright:�TANAKA�Juuyoh�(⽥中⼗洋)�/�License:�CC�BY�2.0 *�Undirected�member-get-member�network�│�Flickr�-�Photo�Sharing! ��https://www.flickr.com/photos/porternovelli/2587018053/ ��Copyright:�Porter�Novelli�Global�/�License:�CC�BY-SA�2.0 *�JTAG�board�1�│�Flickr�-�Photo�Sharing! ��https://www.flickr.com/photos/amagill/2877921712/ ��Copyright:�Andrew�Magill�/�License:�CC�BY�2.0 *�Creative�Commons�BBB�│�Flickr�-�Photo�Sharing! ��https://www.flickr.com/photos/steren/2732488224/ ��Copyright:�Steren�Giannini�/�License:�CC�BY�2.0 *�About�time�I�had�a�whisky�glass!�│�Flickr�-�Photo�Sharing! ��https://www.flickr.com/photos/toolmantim/14834817323/ ��Copyright:�Tim�Lucas�/�License:�CC�BY�2.0 *�Japanese�traditional�style�house�design�/�和⾵建築(わふうけんちく)�│� Flickr�-�Photo�Sharing! ��https://www.flickr.com/photos/tanaka_juuyoh/10720411936/ ��Copyright:�TANAKA�Juuyoh�(⽥中⼗洋)�/�License:�CC�BY�2.0 *�Undirected�member-get-member�network�│�Flickr�-�Photo�Sharing! ��https://www.flickr.com/photos/porternovelli/2587018053/ ��Copyright:�Porter�Novelli�Global�/�License:�CC�BY-SA�2.0 *�JTAG�board�1�│�Flickr�-�Photo�Sharing! ��https://www.flickr.com/photos/amagill/2877921712/ ��Copyright:�Andrew�Magill�/�License:�CC�BY�2.0 *�Creative�Commons�BBB�│�Flickr�-�Photo�Sharing! ��https://www.flickr.com/photos/steren/2732488224/ ��Copyright:�Steren�Giannini�/�License:�CC�BY�2.0 *�About�time�I�had�a�whisky�glass!�│�Flickr�-�Photo�Sharing! ��https://www.flickr.com/photos/toolmantim/14834817323/ ��Copyright:�Tim�Lucas�/�License:�CC�BY�2.0 *�Japanese�traditional�style�house�design�/�和⾵建築(わふうけんちく)�│� Flickr�-�Photo�Sharing! ��https://www.flickr.com/photos/tanaka_juuyoh/10720411936/ ��Copyright:�TANAKA�Juuyoh�(⽥中⼗洋)�/�License:�CC�BY�2.0 *�Undirected�member-get-member�network�│�Flickr�-�Photo�Sharing! ��https://www.flickr.com/photos/porternovelli/2587018053/ ��Copyright:�Porter�Novelli�Global�/�License:�CC�BY-SA�2.0 *�JTAG�board�1�│�Flickr�-�Photo�Sharing! ��https://www.flickr.com/photos/amagill/2877921712/ ��Copyright:�Andrew�Magill�/�License:�CC�BY�2.0 *�Creative�Commons�BBB�│�Flickr�-�Photo�Sharing! ��https://www.flickr.com/photos/steren/2732488224/ ��Copyright:�Steren�Giannini�/�License:�CC�BY�2.0 *�About�time�I�had�a�whisky�glass!�│�Flickr�-�Photo�Sharing! ��https://www.flickr.com/photos/toolmantim/14834817323/ ��Copyright:�Tim�Lucas�/�License:�CC�BY�2.0 *�Japanese�traditional�style�house�design�/�和⾵建築(わふうけんちく)�│� Flickr�-�Photo�Sharing! ��https://www.flickr.com/photos/tanaka_juuyoh/10720411936/ ��Copyright:�TANAKA�Juuyoh�(⽥中⼗洋)�/�License:�CC�BY�2.0 *�Undirected�member-get-member�network�│�Flickr�-�Photo�Sharing! ��https://www.flickr.com/photos/porternovelli/2587018053/ ��Copyright:�Porter�Novelli�Global�/�License:�CC�BY-SA�2.0 *�JTAG�board�1�│�Flickr�-�Photo�Sharing! ��https://www.flickr.com/photos/amagill/2877921712/ ��Copyright:�Andrew�Magill�/�License:�CC�BY�2.0 *�Creative�Commons�BBB�│�Flickr�-�Photo�Sharing! ��https://www.flickr.com/photos/steren/2732488224/ ��Copyright:�Steren�Giannini�/�License:�CC�BY�2.0 *�About�time�I�had�a�whisky�glass!�│�Flickr�-�Photo�Sharing! ��https://www.flickr.com/photos/toolmantim/14834817323/ ��Copyright:�Tim�Lucas�/�License:�CC�BY�2.0 *�Japanese�traditional�style�house�design�/�和⾵建築(わふうけんちく)�│� Flickr�-�Photo�Sharing! ��https://www.flickr.com/photos/tanaka_juuyoh/10720411936/ ��Copyright:�TANAKA�Juuyoh�(⽥中⼗洋)�/�License:�CC�BY�2.0 *�Undirected�member-get-member�network�│�Flickr�-�Photo�Sharing! ��https://www.flickr.com/photos/porternovelli/2587018053/ ��Copyright:�Porter�Novelli�Global�/�License:�CC�BY-SA�2.0 *�JTAG�board�1�│�Flickr�-�Photo�Sharing! ��https://www.flickr.com/photos/amagill/2877921712/ ��Copyright:�Andrew�Magill�/�License:�CC�BY�2.0 *�Creative�Commons�BBB�│�Flickr�-�Photo�Sharing! ��https://www.flickr.com/photos/steren/2732488224/ ��Copyright:�Steren�Giannini�/�License:�CC�BY�2.0