- Learn Type:Driven Development
- Yawar Amin Kamon Ayeva
- 211字
- 2021-07-02 14:41:24
Using Try Reason
Reason provides a fantastic resource for learners: an online Reason-to-JavaScript compiler and evaluator. To access it, go to the Reason website and click Try in the navigation bar at the top. You can use it to quickly try out different ideas.
Let's run through a quick example using Try Reason to get our bearings. Type in the example code from src/Ch01/Ch01_Demo.re into the Reason section of the Try Reason web app. Now add the following line after that:
let bob = makePerson(1, "Bob");
Now if you examine the output JS, you should see that the following changes have been made:
- Types have been stripped away
- Records have been transformed into arrays without field names (records are roughly like C structs or JavaScript objects)
- Every declared value is explicitly exported (made public)
Note that we have purposely introduced very little actual Reason syntax in this chapter. If you are curious to explore the syntax (which is very similar to JavaScript at its core), it's best if you explore the excellent Reason website documentation. Since the focus of this book is type-driven development, in the upcoming chapters we will introduce all the syntax we will need and discuss its impact on our understanding of the code.
- Getting Started with PowerShell
- Java加密與解密的藝術
- 數據結構習題解析與實驗指導
- PLC應用技術(三菱FX2N系列)
- 智能搜索和推薦系統:原理、算法與應用
- Essential C++(中文版)
- Orleans:構建高性能分布式Actor服務
- 貫通Tomcat開發
- UI設計基礎培訓教程(全彩版)
- Puppet:Mastering Infrastructure Automation
- MongoDB Cookbook
- SCRATCH編程課:我的游戲我做主
- HikariCP數據庫連接池實戰
- Spring Boot學習指南:構建云原生Java和Kotlin應用程序
- JavaScript Mobile Application Development